Submission #427758

# Submission time Handle Problem Language Result Execution time Memory
427758 2021-06-14T21:40:21 Z Chaska Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
303 ms 17992 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3005;
ll n,m,res,b[N],c[N];
char a[N][N];
int main()
{
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    cin >> n >> m;
    for (int i=0;i<n;i++) for (int j=0;j<m;j++) cin >> a[i][j];
    for (int j=0;j<m;j++) for (int i=0;i<n;i++) if (a[i][j] == 'I') b[j]++;
    for (int i=0;i<n;i++) for (int j=0;j<m;j++) if (a[i][j] == 'O') c[i]++;
    for (int i=0;i<n;i++) for (int j=0;j<m;j++) 
        if (a[i][j] == 'J') res += b[j]*c[i]; 
        else if (a[i][j] == 'O') c[i]--; 
        else b[j]--;    
    cout << res;
    return 0;
}
# 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 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 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 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 KB Output is correct
14 Correct 8 ms 1996 KB Output is correct
15 Correct 1 ms 1484 KB Output is correct
16 Correct 4 ms 1228 KB Output is correct
17 Correct 1 ms 300 KB Output is correct
18 Correct 11 ms 1996 KB Output is correct
19 Correct 7 ms 1996 KB Output is correct
20 Correct 6 ms 1996 KB Output is correct
21 Correct 9 ms 1996 KB Output is correct
22 Correct 8 ms 1964 KB Output is correct
23 Correct 6 ms 1996 KB Output is correct
24 Correct 10 ms 1996 KB Output is correct
25 Correct 8 ms 1996 KB Output is correct
26 Correct 8 ms 1996 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 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 1 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 588 KB Output is correct
14 Correct 8 ms 1996 KB Output is correct
15 Correct 1 ms 1484 KB Output is correct
16 Correct 4 ms 1228 KB Output is correct
17 Correct 1 ms 300 KB Output is correct
18 Correct 11 ms 1996 KB Output is correct
19 Correct 7 ms 1996 KB Output is correct
20 Correct 6 ms 1996 KB Output is correct
21 Correct 9 ms 1996 KB Output is correct
22 Correct 8 ms 1964 KB Output is correct
23 Correct 6 ms 1996 KB Output is correct
24 Correct 10 ms 1996 KB Output is correct
25 Correct 8 ms 1996 KB Output is correct
26 Correct 8 ms 1996 KB Output is correct
27 Correct 303 ms 17596 KB Output is correct
28 Correct 4 ms 7116 KB Output is correct
29 Correct 15 ms 1740 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 226 ms 13828 KB Output is correct
32 Correct 244 ms 17860 KB Output is correct
33 Correct 223 ms 17812 KB Output is correct
34 Correct 256 ms 16068 KB Output is correct
35 Correct 241 ms 17896 KB Output is correct
36 Correct 217 ms 17808 KB Output is correct
37 Correct 303 ms 17992 KB Output is correct
38 Correct 167 ms 13660 KB Output is correct
39 Correct 148 ms 13744 KB Output is correct