Submission #120482

# Submission time Handle Problem Language Result Execution time Memory
120482 2019-06-24T16:08:06 Z achibasadzishvili Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
439 ms 160040 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,m,O[3003][3003],I[3003][3003],ans;
string s[3005];
int main(){
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
    
    for(int i=1; i<=n; i++){
        cin >> s[i];
        for(int j=m-1; j>=0; j--)
            O[i][j] = O[i][j + 1] + (s[i][j] == 'O');
    }
    
    for(int i=0; i<m; i++)
        for(int j=n; j>=1; j--)
            I[j][i] = I[j + 1][i] + (s[j][i] == 'I');
    
    for(int i=1; i<=n; i++)
        for(int j=0; j<m; j++)
            if(s[i][j] == 'J')
                ans += O[i][j] * I[i][j];
    
    
    cout << ans << endl;
    
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 4 ms 1408 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 3 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 3 ms 1380 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 4 ms 1408 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 3 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 3 ms 1380 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 11 ms 7860 KB Output is correct
15 Correct 5 ms 3968 KB Output is correct
16 Correct 6 ms 4864 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 12 ms 8832 KB Output is correct
19 Correct 12 ms 8704 KB Output is correct
20 Correct 11 ms 8704 KB Output is correct
21 Correct 12 ms 8832 KB Output is correct
22 Correct 12 ms 8668 KB Output is correct
23 Correct 11 ms 8704 KB Output is correct
24 Correct 13 ms 8932 KB Output is correct
25 Correct 12 ms 8704 KB Output is correct
26 Correct 12 ms 8704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 512 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 4 ms 1408 KB Output is correct
7 Correct 4 ms 1280 KB Output is correct
8 Correct 3 ms 1408 KB Output is correct
9 Correct 3 ms 1408 KB Output is correct
10 Correct 3 ms 1280 KB Output is correct
11 Correct 3 ms 1380 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 11 ms 7860 KB Output is correct
15 Correct 5 ms 3968 KB Output is correct
16 Correct 6 ms 4864 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 12 ms 8832 KB Output is correct
19 Correct 12 ms 8704 KB Output is correct
20 Correct 11 ms 8704 KB Output is correct
21 Correct 12 ms 8832 KB Output is correct
22 Correct 12 ms 8668 KB Output is correct
23 Correct 11 ms 8704 KB Output is correct
24 Correct 13 ms 8932 KB Output is correct
25 Correct 12 ms 8704 KB Output is correct
26 Correct 12 ms 8704 KB Output is correct
27 Correct 379 ms 158996 KB Output is correct
28 Correct 36 ms 19652 KB Output is correct
29 Correct 17 ms 13952 KB Output is correct
30 Correct 3 ms 896 KB Output is correct
31 Correct 278 ms 130836 KB Output is correct
32 Correct 386 ms 159836 KB Output is correct
33 Correct 386 ms 159468 KB Output is correct
34 Correct 329 ms 151644 KB Output is correct
35 Correct 379 ms 159868 KB Output is correct
36 Correct 382 ms 159428 KB Output is correct
37 Correct 439 ms 160040 KB Output is correct
38 Correct 257 ms 130180 KB Output is correct
39 Correct 264 ms 130208 KB Output is correct