Submission #539776

# Submission time Handle Problem Language Result Execution time Memory
539776 2022-03-19T07:11:36 Z krit3379 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
280 ms 88500 KB
#include<bits/stdc++.h>
using namespace std;
#define N 3005

int a[N][N],b[N][N];
long long ans;
char s[N][N];

int main(){
    int n,m,i,j;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++){
        scanf(" %s",s[i]+1);
    }
    for(i=1;i<=n;i++){
        for(j=m;j>0;j--){
            if(s[i][j]=='O')a[i][j]++;
            a[i][j]+=a[i][j+1];
        }
    }
    for(i=1;i<=m;i++){
        for(j=n;j>0;j--){
            if(s[j][i]=='I')b[j][i]++;
            b[j][i]+=b[j+1][i];
        }
    }
    for(i=1;i<=n;i++)for(j=1;j<=m;j++)if(s[i][j]=='J')ans+=a[i][j]*b[i][j];
    printf("%lld",ans);
    return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf(" %s",s[i]+1);
      |         ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1476 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1352 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1412 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1476 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1352 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1412 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 9 ms 7420 KB Output is correct
15 Correct 3 ms 4928 KB Output is correct
16 Correct 5 ms 4276 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 12 ms 8008 KB Output is correct
19 Correct 8 ms 7888 KB Output is correct
20 Correct 8 ms 7760 KB Output is correct
21 Correct 11 ms 8020 KB Output is correct
22 Correct 8 ms 7920 KB Output is correct
23 Correct 7 ms 7764 KB Output is correct
24 Correct 10 ms 8020 KB Output is correct
25 Correct 8 ms 7888 KB Output is correct
26 Correct 8 ms 7892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 1476 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 2 ms 1352 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1492 KB Output is correct
10 Correct 1 ms 1412 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 1 ms 1492 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 9 ms 7420 KB Output is correct
15 Correct 3 ms 4928 KB Output is correct
16 Correct 5 ms 4276 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 12 ms 8008 KB Output is correct
19 Correct 8 ms 7888 KB Output is correct
20 Correct 8 ms 7760 KB Output is correct
21 Correct 11 ms 8020 KB Output is correct
22 Correct 8 ms 7920 KB Output is correct
23 Correct 7 ms 7764 KB Output is correct
24 Correct 10 ms 8020 KB Output is correct
25 Correct 8 ms 7888 KB Output is correct
26 Correct 8 ms 7892 KB Output is correct
27 Correct 280 ms 87972 KB Output is correct
28 Correct 18 ms 25940 KB Output is correct
29 Correct 12 ms 7764 KB Output is correct
30 Correct 2 ms 596 KB Output is correct
31 Correct 217 ms 72580 KB Output is correct
32 Correct 264 ms 88408 KB Output is correct
33 Correct 243 ms 88200 KB Output is correct
34 Correct 229 ms 84140 KB Output is correct
35 Correct 260 ms 88436 KB Output is correct
36 Correct 269 ms 88096 KB Output is correct
37 Correct 270 ms 88500 KB Output is correct
38 Correct 186 ms 72600 KB Output is correct
39 Correct 209 ms 72244 KB Output is correct