Submission #391393

# Submission time Handle Problem Language Result Execution time Memory
391393 2021-04-18T16:50:53 Z lukameladze Bitaro the Brave (JOI19_ho_t1) C++14
50 / 100
1000 ms 75672 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() {
     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<<endl;
}
# 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 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 2 ms 1344 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 2 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 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 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 2 ms 1344 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 2 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 19 ms 8708 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 12 ms 5080 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 29 ms 9648 KB Output is correct
19 Correct 24 ms 9484 KB Output is correct
20 Correct 25 ms 9420 KB Output is correct
21 Correct 24 ms 9680 KB Output is correct
22 Correct 26 ms 9552 KB Output is correct
23 Correct 22 ms 9420 KB Output is correct
24 Correct 29 ms 9664 KB Output is correct
25 Correct 27 ms 9532 KB Output is correct
26 Correct 22 ms 9476 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 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 1484 KB Output is correct
6 Correct 2 ms 1484 KB Output is correct
7 Correct 2 ms 1344 KB Output is correct
8 Correct 2 ms 1484 KB Output is correct
9 Correct 2 ms 1484 KB Output is correct
10 Correct 2 ms 1356 KB Output is correct
11 Correct 2 ms 1484 KB Output is correct
12 Correct 2 ms 1484 KB Output is correct
13 Correct 2 ms 1356 KB Output is correct
14 Correct 19 ms 8708 KB Output is correct
15 Correct 4 ms 4940 KB Output is correct
16 Correct 12 ms 5080 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 29 ms 9648 KB Output is correct
19 Correct 24 ms 9484 KB Output is correct
20 Correct 25 ms 9420 KB Output is correct
21 Correct 24 ms 9680 KB Output is correct
22 Correct 26 ms 9552 KB Output is correct
23 Correct 22 ms 9420 KB Output is correct
24 Correct 29 ms 9664 KB Output is correct
25 Correct 27 ms 9532 KB Output is correct
26 Correct 22 ms 9476 KB Output is correct
27 Execution timed out 1094 ms 75672 KB Time limit exceeded
28 Halted 0 ms 0 KB -