# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110675 | 2019-05-11T21:52:22 Z | Breno_XD | Bitaro the Brave (JOI19_ho_t1) | C++14 | 1000 ms | 117524 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=1; i<=M; i++){ for(int j=1; j<=N; j++){ if(matriz[j][i]==1) row[j][i]+=++r; else row[j][i]=r; } 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][M]-column[i][j])*(row[N][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 | 2 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 | 3 ms | 1664 KB | Output is correct |
7 | Correct | 3 ms | 1536 KB | Output is correct |
8 | Correct | 4 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1536 KB | Output is correct |
11 | Correct | 5 ms | 1792 KB | Output is correct |
12 | Correct | 3 ms | 1664 KB | Output is correct |
13 | Correct | 5 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 | 2 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 | 3 ms | 1664 KB | Output is correct |
7 | Correct | 3 ms | 1536 KB | Output is correct |
8 | Correct | 4 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1536 KB | Output is correct |
11 | Correct | 5 ms | 1792 KB | Output is correct |
12 | Correct | 3 ms | 1664 KB | Output is correct |
13 | Correct | 5 ms | 1536 KB | Output is correct |
14 | Correct | 23 ms | 8568 KB | Output is correct |
15 | Correct | 6 ms | 5376 KB | Output is correct |
16 | Correct | 14 ms | 4864 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 29 ms | 9300 KB | Output is correct |
19 | Correct | 25 ms | 9088 KB | Output is correct |
20 | Correct | 25 ms | 8944 KB | Output is correct |
21 | Correct | 29 ms | 9336 KB | Output is correct |
22 | Correct | 25 ms | 9208 KB | Output is correct |
23 | Correct | 25 ms | 8960 KB | Output is correct |
24 | Correct | 27 ms | 9336 KB | Output is correct |
25 | Correct | 35 ms | 8952 KB | Output is correct |
26 | Correct | 23 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 | 2 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 | 3 ms | 1664 KB | Output is correct |
7 | Correct | 3 ms | 1536 KB | Output is correct |
8 | Correct | 4 ms | 1664 KB | Output is correct |
9 | Correct | 3 ms | 1664 KB | Output is correct |
10 | Correct | 4 ms | 1536 KB | Output is correct |
11 | Correct | 5 ms | 1792 KB | Output is correct |
12 | Correct | 3 ms | 1664 KB | Output is correct |
13 | Correct | 5 ms | 1536 KB | Output is correct |
14 | Correct | 23 ms | 8568 KB | Output is correct |
15 | Correct | 6 ms | 5376 KB | Output is correct |
16 | Correct | 14 ms | 4864 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 29 ms | 9300 KB | Output is correct |
19 | Correct | 25 ms | 9088 KB | Output is correct |
20 | Correct | 25 ms | 8944 KB | Output is correct |
21 | Correct | 29 ms | 9336 KB | Output is correct |
22 | Correct | 25 ms | 9208 KB | Output is correct |
23 | Correct | 25 ms | 8960 KB | Output is correct |
24 | Correct | 27 ms | 9336 KB | Output is correct |
25 | Correct | 35 ms | 8952 KB | Output is correct |
26 | Correct | 23 ms | 8960 KB | Output is correct |
27 | Correct | 952 ms | 114996 KB | Output is correct |
28 | Correct | 26 ms | 28380 KB | Output is correct |
29 | Correct | 51 ms | 9848 KB | Output is correct |
30 | Correct | 4 ms | 768 KB | Output is correct |
31 | Correct | 644 ms | 99024 KB | Output is correct |
32 | Correct | 769 ms | 113088 KB | Output is correct |
33 | Correct | 741 ms | 113568 KB | Output is correct |
34 | Correct | 860 ms | 113784 KB | Output is correct |
35 | Correct | 895 ms | 114300 KB | Output is correct |
36 | Correct | 870 ms | 113480 KB | Output is correct |
37 | Execution timed out | 1004 ms | 117524 KB | Time limit exceeded |
38 | Halted | 0 ms | 0 KB | - |