Submission #334940

# Submission time Handle Problem Language Result Execution time Memory
334940 2020-12-10T11:51:15 Z Swan Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
318 ms 88428 KB
#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("hopscotch.in","r",stdin)
#define OUTP freopen("hopscotch.out","w",stdout)
#define int long long
using namespace std;


const int maxn = 3001;
const int maxm = 3001;

char arr[maxn][maxm];
int ingotDown[maxn][maxm];

main(){
    ios_base::sync_with_stdio(0);
    int n, m; cin >> n >> m;
    for(int i = 0; i < n;i++){
        for(int j = 0; j < m;j++){
            cin >> arr[i][j];
        }
    }
    for(int i = n-1 ;i>= 0;i--){
        for(int j = 0;j < m;j++){
            if(arr[i][j] == 'I'){
                ingotDown[i][j]++;
            }
            if(i!=n-1){
                ingotDown[i][j]+=ingotDown[i + 1][j];
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < n;i++){
        int orbCnt = 0;
        for(int j = m-1 ;j>=0;j--){
            if(arr[i][j] == 'O')orbCnt++;
            if(arr[i][j] ==  'J'){
                //cout << "QWE " << i << ' ' << j << ' ' << orbCnt << ' ' << ingotDown[i][j] << endl;
                ans+= ingotDown[i][j] * orbCnt;
            }
        }
        //cout << ans << endl;
    }
    cout << ans;
    return 0;
}
/*
*/

Compilation message

joi2019_ho_t1.cpp:15:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1132 KB Output is correct
7 Correct 0 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1132 KB Output is correct
7 Correct 0 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 9 ms 5484 KB Output is correct
15 Correct 2 ms 3308 KB Output is correct
16 Correct 5 ms 3308 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 12 ms 5996 KB Output is correct
19 Correct 9 ms 5996 KB Output is correct
20 Correct 9 ms 5868 KB Output is correct
21 Correct 11 ms 5996 KB Output is correct
22 Correct 9 ms 5996 KB Output is correct
23 Correct 9 ms 5868 KB Output is correct
24 Correct 11 ms 5996 KB Output is correct
25 Correct 9 ms 5996 KB Output is correct
26 Correct 9 ms 5868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 1 ms 1132 KB Output is correct
7 Correct 0 ms 1004 KB Output is correct
8 Correct 1 ms 1132 KB Output is correct
9 Correct 1 ms 1132 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 1 ms 1132 KB Output is correct
12 Correct 1 ms 1132 KB Output is correct
13 Correct 1 ms 1004 KB Output is correct
14 Correct 9 ms 5484 KB Output is correct
15 Correct 2 ms 3308 KB Output is correct
16 Correct 5 ms 3308 KB Output is correct
17 Correct 1 ms 492 KB Output is correct
18 Correct 12 ms 5996 KB Output is correct
19 Correct 9 ms 5996 KB Output is correct
20 Correct 9 ms 5868 KB Output is correct
21 Correct 11 ms 5996 KB Output is correct
22 Correct 9 ms 5996 KB Output is correct
23 Correct 9 ms 5868 KB Output is correct
24 Correct 11 ms 5996 KB Output is correct
25 Correct 9 ms 5996 KB Output is correct
26 Correct 9 ms 5868 KB Output is correct
27 Correct 318 ms 87896 KB Output is correct
28 Correct 10 ms 16748 KB Output is correct
29 Correct 18 ms 7788 KB Output is correct
30 Correct 1 ms 620 KB Output is correct
31 Correct 236 ms 72812 KB Output is correct
32 Correct 249 ms 88428 KB Output is correct
33 Correct 240 ms 88172 KB Output is correct
34 Correct 278 ms 84076 KB Output is correct
35 Correct 253 ms 88396 KB Output is correct
36 Correct 243 ms 88212 KB Output is correct
37 Correct 314 ms 88428 KB Output is correct
38 Correct 177 ms 72300 KB Output is correct
39 Correct 178 ms 72188 KB Output is correct