# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110679 | 2019-05-11T21:58:57 Z | Breno_XD | Bitaro the Brave (JOI19_ho_t1) | C++14 | 1000 ms | 113108 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3200; int N,M; long long ans; int matriz[MAXN][MAXN]; int row[MAXN][MAXN], r; int column[MAXN][MAXN], c; char letra; int main(){ //Leitura scanf("%d%d", &N, &M); for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cin >> letra; if(letra=='J') matriz[i][j]=-1; if(letra=='I') matriz[i][j]=1; if(letra=='O') column[i][j]+=++c; else column[i][j]=c; } c=0; } for(int i=0; i<=M; i++){ for(int j=N; j>=1; j--){ if(matriz[j][i]==1) row[j][i]+=++r; else row[j][i]=r; column[j][i] = column[j][M]-column[j][i]; } r=0; } /* cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << matriz[i][j] << " "; } cout << endl; } cout << endl; cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << row[i][j] << " "; } cout << endl; } cout << endl; cout << endl; for(int i=1; i<=N; i++){ for(int j=1; j<=M; j++){ cout << column[i][j] << " "; } cout << endl; } cout << endl; */ for(int i=1; i<=N; i++) for(int j=1; j<=M; j++) if(matriz[i][j]==-1) ans+= column[i][j]*row[i][j]; printf("%lld", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 4 ms | 1664 KB | Output is correct |
6 | Correct | 4 ms | 1664 KB | Output is correct |
7 | Correct | 4 ms | 1664 KB | Output is correct |
8 | Correct | 3 ms | 1664 KB | Output is correct |
9 | Correct | 4 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1508 KB | Output is correct |
11 | Correct | 4 ms | 1664 KB | Output is correct |
12 | Correct | 4 ms | 1664 KB | Output is correct |
13 | Correct | 3 ms | 1536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 4 ms | 1664 KB | Output is correct |
6 | Correct | 4 ms | 1664 KB | Output is correct |
7 | Correct | 4 ms | 1664 KB | Output is correct |
8 | Correct | 3 ms | 1664 KB | Output is correct |
9 | Correct | 4 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1508 KB | Output is correct |
11 | Correct | 4 ms | 1664 KB | Output is correct |
12 | Correct | 4 ms | 1664 KB | Output is correct |
13 | Correct | 3 ms | 1536 KB | Output is correct |
14 | Correct | 25 ms | 8576 KB | Output is correct |
15 | Correct | 7 ms | 5504 KB | Output is correct |
16 | Correct | 16 ms | 4864 KB | Output is correct |
17 | Correct | 2 ms | 512 KB | Output is correct |
18 | Correct | 34 ms | 9336 KB | Output is correct |
19 | Correct | 37 ms | 9080 KB | Output is correct |
20 | Correct | 26 ms | 8828 KB | Output is correct |
21 | Correct | 30 ms | 9336 KB | Output is correct |
22 | Correct | 26 ms | 9208 KB | Output is correct |
23 | Correct | 30 ms | 8952 KB | Output is correct |
24 | Correct | 32 ms | 9336 KB | Output is correct |
25 | Correct | 27 ms | 8952 KB | Output is correct |
26 | Correct | 27 ms | 8960 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 4 ms | 1664 KB | Output is correct |
6 | Correct | 4 ms | 1664 KB | Output is correct |
7 | Correct | 4 ms | 1664 KB | Output is correct |
8 | Correct | 3 ms | 1664 KB | Output is correct |
9 | Correct | 4 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1508 KB | Output is correct |
11 | Correct | 4 ms | 1664 KB | Output is correct |
12 | Correct | 4 ms | 1664 KB | Output is correct |
13 | Correct | 3 ms | 1536 KB | Output is correct |
14 | Correct | 25 ms | 8576 KB | Output is correct |
15 | Correct | 7 ms | 5504 KB | Output is correct |
16 | Correct | 16 ms | 4864 KB | Output is correct |
17 | Correct | 2 ms | 512 KB | Output is correct |
18 | Correct | 34 ms | 9336 KB | Output is correct |
19 | Correct | 37 ms | 9080 KB | Output is correct |
20 | Correct | 26 ms | 8828 KB | Output is correct |
21 | Correct | 30 ms | 9336 KB | Output is correct |
22 | Correct | 26 ms | 9208 KB | Output is correct |
23 | Correct | 30 ms | 8952 KB | Output is correct |
24 | Correct | 32 ms | 9336 KB | Output is correct |
25 | Correct | 27 ms | 8952 KB | Output is correct |
26 | Correct | 27 ms | 8960 KB | Output is correct |
27 | Execution timed out | 1084 ms | 113108 KB | Time limit exceeded |
28 | Halted | 0 ms | 0 KB | - |