Submission #374756

# Submission time Handle Problem Language Result Execution time Memory
374756 2021-03-08T05:52:30 Z daniel920712 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
180 ms 18156 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;
long long con1[5][3005]={0};
long long con2[5][3005]={0};
char all[3005][3005];
int main()
{
    long long N,M,ans=0,i,j;
    scanf("%lld %lld",&N,&M);
    for(i=0;i<N;i++)
    {
        scanf("%s",all[i]);
        for(j=0;j<M;j++)
        {
            if(all[i][j]=='J')
            {
                con1[0][i]++;
                con2[0][j]++;
            }
            else if(all[i][j]=='O')
            {
                con1[1][i]++;
                con2[1][j]++;
            }
            else
            {
                con1[2][i]++;
                con2[2][j]++;
            }
        }
    }
    for(i=0;i<N;i++)
    {
        for(j=0;j<M;j++)
        {


            if(all[i][j]=='J') ans+=(con1[1][i])*(con2[2][j]);

            if(all[i][j]=='J')
            {
                con1[0][i]--;
                con2[0][j]--;
            }
            else if(all[i][j]=='O')
            {
                con1[1][i]--;
                con2[1][j]--;
            }
            else
            {
                con1[2][i]--;
                con2[2][j]--;
            }


        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%lld %lld",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |         scanf("%s",all[i]);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 620 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 620 KB Output is correct
13 Correct 1 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 620 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 620 KB Output is correct
13 Correct 1 ms 620 KB Output is correct
14 Correct 5 ms 1772 KB Output is correct
15 Correct 1 ms 1644 KB Output is correct
16 Correct 2 ms 1132 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 1920 KB Output is correct
19 Correct 4 ms 1772 KB Output is correct
20 Correct 4 ms 1772 KB Output is correct
21 Correct 7 ms 2028 KB Output is correct
22 Correct 4 ms 2028 KB Output is correct
23 Correct 4 ms 2028 KB Output is correct
24 Correct 6 ms 2028 KB Output is correct
25 Correct 4 ms 2028 KB Output is correct
26 Correct 4 ms 2028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 1 ms 620 KB Output is correct
8 Correct 1 ms 620 KB Output is correct
9 Correct 1 ms 620 KB Output is correct
10 Correct 1 ms 620 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 620 KB Output is correct
13 Correct 1 ms 620 KB Output is correct
14 Correct 5 ms 1772 KB Output is correct
15 Correct 1 ms 1644 KB Output is correct
16 Correct 2 ms 1132 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 1920 KB Output is correct
19 Correct 4 ms 1772 KB Output is correct
20 Correct 4 ms 1772 KB Output is correct
21 Correct 7 ms 2028 KB Output is correct
22 Correct 4 ms 2028 KB Output is correct
23 Correct 4 ms 2028 KB Output is correct
24 Correct 6 ms 2028 KB Output is correct
25 Correct 4 ms 2028 KB Output is correct
26 Correct 4 ms 2028 KB Output is correct
27 Correct 171 ms 17644 KB Output is correct
28 Correct 5 ms 7276 KB Output is correct
29 Correct 7 ms 1772 KB Output is correct
30 Correct 1 ms 492 KB Output is correct
31 Correct 128 ms 14060 KB Output is correct
32 Correct 109 ms 18048 KB Output is correct
33 Correct 101 ms 18156 KB Output is correct
34 Correct 147 ms 16108 KB Output is correct
35 Correct 90 ms 18028 KB Output is correct
36 Correct 86 ms 18028 KB Output is correct
37 Correct 180 ms 18108 KB Output is correct
38 Correct 67 ms 14060 KB Output is correct
39 Correct 61 ms 13804 KB Output is correct