Submission #693940

# Submission time Handle Problem Language Result Execution time Memory
693940 2023-02-03T12:26:52 Z Gital Bitaro the Brave (JOI19_ho_t1) C++11
20 / 100
1000 ms 684 KB
#include<bits/stdc++.h>
using namespace std;
#define endl '\n';
typedef long long ll;
int H,W;
string S[3005];
ll ans = 0;
void searchC (int i , int j , char c) {
    if(c == 'I') {
        for(int k = i + 1; k <= H; k++) {
            if(S[k][j] == 'I') {
                searchC(i,j,'O');
            }
        }
    }
    else if (c == 'O') {
        for(int l = j + 1; l <= W; l++) {
            if(S[i][l] == 'O') {
                ans += 1;
                //cout << i << " " << j << endl;
            }
        }
    }
    return;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> H >> W;
    for(int i = 1; i<= H; i++) {
        string s; cin >> s;
        S[i] = s;
        //cout << S[i] << endl;
    }

    for(int i = 1; i <= H; i++) {
        for(int j = 0; j < W; j++) {
            if(S[i][j] == 'J') {
                //cout << i << " " << j;
                searchC(i,j,'I');
            }
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 412 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 15 ms 340 KB Output is correct
8 Correct 7 ms 440 KB Output is correct
9 Correct 2 ms 416 KB Output is correct
10 Correct 15 ms 340 KB Output is correct
11 Correct 5 ms 440 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 16 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 412 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 15 ms 340 KB Output is correct
8 Correct 7 ms 440 KB Output is correct
9 Correct 2 ms 416 KB Output is correct
10 Correct 15 ms 340 KB Output is correct
11 Correct 5 ms 440 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 16 ms 340 KB Output is correct
14 Execution timed out 1068 ms 684 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 412 KB Output is correct
5 Correct 7 ms 440 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 15 ms 340 KB Output is correct
8 Correct 7 ms 440 KB Output is correct
9 Correct 2 ms 416 KB Output is correct
10 Correct 15 ms 340 KB Output is correct
11 Correct 5 ms 440 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 16 ms 340 KB Output is correct
14 Execution timed out 1068 ms 684 KB Time limit exceeded
15 Halted 0 ms 0 KB -