Submission #391396

# Submission time Handle Problem Language Result Execution time Memory
391396 2021-04-18T16:51:44 Z lukameladze Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
475 ms 155888 KB
# include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
const int N=3005;
long long n,m,ans,sf1[N][N],sf[N][N];
char ch[N][N];
int main() {
     std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
     cin>>n>>m;
     for(int i=1; i<=n; i++) {
          for (int j=1; j<=m; j++) {
               cin>>ch[i][j];
          }
     }
     for (int i=1; i<=n; i++) {
          for (int j=m; j>=1; j--) {
               sf[i][j]=sf[i][j+1]+(ch[i][j]=='O');
          }
     }
     for (int j=1; j<=m; j++) {
          for (int i=n; i>=1; i--) {
               sf1[i][j]=sf1[i+1][j]+(ch[i][j]=='I');
          }
     }
     //cout<<sf[1][2]<<endl;
    // cout<<sf1[2][1];
     for (int i=1; i<=n; i++) {
          for (int j=1; j<=m; j++) {
               if (ch[i][j]!='J') continue;
               ans+=sf[i][j+1]*sf1[i+1][j];
          }
     }
     cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 12 ms 8780 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 7 ms 5176 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 12 ms 9676 KB Output is correct
19 Correct 11 ms 9596 KB Output is correct
20 Correct 12 ms 9476 KB Output is correct
21 Correct 13 ms 9804 KB Output is correct
22 Correct 12 ms 9548 KB Output is correct
23 Correct 11 ms 9548 KB Output is correct
24 Correct 12 ms 9676 KB Output is correct
25 Correct 11 ms 9560 KB Output is correct
26 Correct 11 ms 9520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 292 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 12 ms 8780 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 7 ms 5176 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 12 ms 9676 KB Output is correct
19 Correct 11 ms 9596 KB Output is correct
20 Correct 12 ms 9476 KB Output is correct
21 Correct 13 ms 9804 KB Output is correct
22 Correct 12 ms 9548 KB Output is correct
23 Correct 11 ms 9548 KB Output is correct
24 Correct 12 ms 9676 KB Output is correct
25 Correct 11 ms 9560 KB Output is correct
26 Correct 11 ms 9520 KB Output is correct
27 Correct 446 ms 150520 KB Output is correct
28 Correct 18 ms 26316 KB Output is correct
29 Correct 23 ms 13856 KB Output is correct
30 Correct 1 ms 716 KB Output is correct
31 Correct 347 ms 130276 KB Output is correct
32 Correct 436 ms 155880 KB Output is correct
33 Correct 431 ms 155360 KB Output is correct
34 Correct 390 ms 150764 KB Output is correct
35 Correct 431 ms 155848 KB Output is correct
36 Correct 438 ms 155332 KB Output is correct
37 Correct 475 ms 155888 KB Output is correct
38 Correct 320 ms 129600 KB Output is correct
39 Correct 313 ms 129732 KB Output is correct