답안 #374755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374755 2021-03-08T05:51:52 Z daniel920712 Bitaro the Brave (JOI19_ho_t1) C++14
20 / 100
8 ms 2156 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;
int con1[5][3005]={0};
int con2[5][3005]={0};
char all[3005][3005];
int main()
{
    int N,M,ans=0,i,j;
    scanf("%d %d",&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("%d\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("%d %d",&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]);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 768 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
# 결과 실행 시간 메모리 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 768 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 2028 KB Output is correct
15 Correct 1 ms 1644 KB Output is correct
16 Correct 2 ms 1260 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 2028 KB Output is correct
19 Correct 4 ms 2156 KB Output is correct
20 Incorrect 5 ms 2028 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 768 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 2028 KB Output is correct
15 Correct 1 ms 1644 KB Output is correct
16 Correct 2 ms 1260 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 8 ms 2028 KB Output is correct
19 Correct 4 ms 2156 KB Output is correct
20 Incorrect 5 ms 2028 KB Output isn't correct
21 Halted 0 ms 0 KB -