Submission #693940

#TimeUsernameProblemLanguageResultExecution timeMemory
693940GitalBitaro the Brave (JOI19_ho_t1)C++11
20 / 100
1068 ms684 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...