Submission #160523

# Submission time Handle Problem Language Result Execution time Memory
160523 2019-10-28T09:30:52 Z dantoh000 Bitaro the Brave (JOI19_ho_t1) C++14
20 / 100
20 ms 2808 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    char grid[n][m];
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            scanf(" %c",&grid[i][j]);
        }
    }
    int ct1[n][m];
    for (int j = 0; j < m; j++){
        ct1[n-1][j] = (grid[n-1][j]=='I');
        for (int i = n-2; i >= 0; i--){
            ct1[i][j] = ct1[i+1][j] + (grid[i][j]=='I');
        }
    }
    int ct2[n][m];
    for (int i = 0; i < n; i++){
        ct2[i][m-1] = (grid[i][m-1]=='O');
        for (int j = m-2; j >= 0; j--){
            ct2[i][j] = ct2[i][j+1] + (grid[i][j]=='O');
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            if (grid[i][j] == 'J') {
                ans += ct1[i][j]*ct2[i][j];
            }
        }
    }
    printf("%d ",ans);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:9:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %c",&grid[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 16 ms 2260 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 11 ms 1656 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 20 ms 2808 KB Output is correct
19 Correct 18 ms 2680 KB Output is correct
20 Incorrect 19 ms 2680 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 16 ms 2260 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 11 ms 1656 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 20 ms 2808 KB Output is correct
19 Correct 18 ms 2680 KB Output is correct
20 Incorrect 19 ms 2680 KB Output isn't correct
21 Halted 0 ms 0 KB -