답안 #334882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334882 2020-12-10T06:59:02 Z MilosMilutinovic Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
361 ms 89708 KB
#include <bits/stdc++.h>
using namespace std;
const int N=3050;
int h,w,l[N][N],d[N][N];
char s[N][N];
int main(){
    scanf("%i %i",&h,&w);
    for(int i=0;i<h;i++)scanf("%s",&s[i]);
    for(int i=0;i<h;i++){
        for(int j=w-1;j>=0;j--){
            if(j<w-1)l[i][j]=l[i][j+1];
            if(s[i][j]=='O')l[i][j]++;
        }
    }
    for(int j=0;j<w;j++){
        for(int i=h-1;i>=0;i--){
            if(i<h-1)d[i][j]=d[i+1][j];
            if(s[i][j]=='I')d[i][j]++;
        }
    }
    long long ans=0;
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)if(s[i][j]=='J')ans+=d[i][j]*l[i][j];
    printf("%lld",ans);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:33: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[3050]' [-Wformat=]
    8 |     for(int i=0;i<h;i++)scanf("%s",&s[i]);
      |                                ~^  ~~~~~
      |                                 |  |
      |                                 |  char (*)[3050]
      |                                 char*
joi2019_ho_t1.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%i %i",&h,&w);
      |     ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(int i=0;i<h;i++)scanf("%s",&s[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 492 KB Output is correct
5 Correct 1 ms 1516 KB Output is correct
6 Correct 2 ms 1660 KB Output is correct
7 Correct 1 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 1 ms 1516 KB Output is correct
10 Correct 1 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 2 ms 1388 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 492 KB Output is correct
5 Correct 1 ms 1516 KB Output is correct
6 Correct 2 ms 1660 KB Output is correct
7 Correct 1 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 1 ms 1516 KB Output is correct
10 Correct 1 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 2 ms 1388 KB Output is correct
14 Correct 11 ms 7532 KB Output is correct
15 Correct 3 ms 4972 KB Output is correct
16 Correct 4 ms 4332 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 11 ms 8044 KB Output is correct
19 Correct 9 ms 7916 KB Output is correct
20 Correct 8 ms 7916 KB Output is correct
21 Correct 10 ms 8044 KB Output is correct
22 Correct 9 ms 7916 KB Output is correct
23 Correct 8 ms 7916 KB Output is correct
24 Correct 10 ms 8044 KB Output is correct
25 Correct 9 ms 7916 KB Output is correct
26 Correct 8 ms 7916 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 492 KB Output is correct
5 Correct 1 ms 1516 KB Output is correct
6 Correct 2 ms 1660 KB Output is correct
7 Correct 1 ms 1388 KB Output is correct
8 Correct 1 ms 1516 KB Output is correct
9 Correct 1 ms 1516 KB Output is correct
10 Correct 1 ms 1388 KB Output is correct
11 Correct 2 ms 1516 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 2 ms 1388 KB Output is correct
14 Correct 11 ms 7532 KB Output is correct
15 Correct 3 ms 4972 KB Output is correct
16 Correct 4 ms 4332 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 11 ms 8044 KB Output is correct
19 Correct 9 ms 7916 KB Output is correct
20 Correct 8 ms 7916 KB Output is correct
21 Correct 10 ms 8044 KB Output is correct
22 Correct 9 ms 7916 KB Output is correct
23 Correct 8 ms 7916 KB Output is correct
24 Correct 10 ms 8044 KB Output is correct
25 Correct 9 ms 7916 KB Output is correct
26 Correct 8 ms 7916 KB Output is correct
27 Correct 330 ms 89196 KB Output is correct
28 Correct 16 ms 26220 KB Output is correct
29 Correct 13 ms 7916 KB Output is correct
30 Correct 1 ms 748 KB Output is correct
31 Correct 245 ms 73580 KB Output is correct
32 Correct 300 ms 89580 KB Output is correct
33 Correct 281 ms 89452 KB Output is correct
34 Correct 277 ms 85356 KB Output is correct
35 Correct 283 ms 89708 KB Output is correct
36 Correct 281 ms 89452 KB Output is correct
37 Correct 361 ms 89708 KB Output is correct
38 Correct 213 ms 73652 KB Output is correct
39 Correct 212 ms 73456 KB Output is correct