Submission #107156

# Submission time Handle Problem Language Result Execution time Memory
107156 2019-04-22T08:26:17 Z abil Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
514 ms 159316 KB
#include <bits/stdc++.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define int long long

using namespace std;

const int inf = (int)1e9 + 7  ;
const long long mod = 1e9 + 7;
const int N = (int)3007;

int n, m;
char ch[N][N],c;
int jo[N][N], joop[N][N];
main(){
      cin >> n >> m;
      for(int i = 1;i <= n; i++){
            int cnt = 0;
            scanf(" %s", ch[i]);
            for(int j = 0;j < m; j++){
                  cnt += (ch[i][j] == 'O');
            }
            for(int j = 0;j < m; j++){
                  if(ch[i][j] == 'J'){
                        jo[i][j] = cnt;
                  }
                  cnt -= (ch[i][j] == 'O');
            }
      }
      for(int j = 0;j < m; j++){
            for(int i = 1;i <= n; i++){
                  joop[i][j] = joop[i - 1][j] + jo[i][j];
            }
      }
      int ans = 0;
      for(int i = 1;i <= n; i++){
            for(int j = 0;j < m; j++){
                  if(ch[i][j] == 'I'){
                        ans += joop[i][j];
                  }
            }
      }
      cout << ans;

}

Compilation message

joi2019_ho_t1.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %s", ch[i]);
             ~~~~~^~~~~~~~~~~~~~
# 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 3 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 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 3 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 17 ms 8832 KB Output is correct
15 Correct 6 ms 4864 KB Output is correct
16 Correct 8 ms 4736 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 15 ms 9728 KB Output is correct
19 Correct 13 ms 8704 KB Output is correct
20 Correct 13 ms 8248 KB Output is correct
21 Correct 15 ms 9728 KB Output is correct
22 Correct 12 ms 8960 KB Output is correct
23 Correct 10 ms 8320 KB Output is correct
24 Correct 15 ms 9672 KB Output is correct
25 Correct 11 ms 8704 KB Output is correct
26 Correct 14 ms 8320 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 3 ms 512 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 3 ms 1408 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 17 ms 8832 KB Output is correct
15 Correct 6 ms 4864 KB Output is correct
16 Correct 8 ms 4736 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 15 ms 9728 KB Output is correct
19 Correct 13 ms 8704 KB Output is correct
20 Correct 13 ms 8248 KB Output is correct
21 Correct 15 ms 9728 KB Output is correct
22 Correct 12 ms 8960 KB Output is correct
23 Correct 10 ms 8320 KB Output is correct
24 Correct 15 ms 9672 KB Output is correct
25 Correct 11 ms 8704 KB Output is correct
26 Correct 14 ms 8320 KB Output is correct
27 Correct 514 ms 150484 KB Output is correct
28 Correct 23 ms 25720 KB Output is correct
29 Correct 18 ms 10240 KB Output is correct
30 Correct 3 ms 896 KB Output is correct
31 Correct 404 ms 125432 KB Output is correct
32 Correct 479 ms 128268 KB Output is correct
33 Correct 418 ms 123896 KB Output is correct
34 Correct 413 ms 152440 KB Output is correct
35 Correct 500 ms 142644 KB Output is correct
36 Correct 434 ms 123640 KB Output is correct
37 Correct 512 ms 159316 KB Output is correct
38 Correct 292 ms 108792 KB Output is correct
39 Correct 297 ms 98704 KB Output is correct