Submission #110405

#TimeUsernameProblemLanguageResultExecution timeMemory
110405saidBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
1075 ms640 KiB
#include <iostream>

using namespace std;

#define MAXH 3010

int h, w;
string s[MAXH];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin >> h >> w;
    for(int i = 0; i < h; i++)
        cin >> s[i];

    int qt = 0;
    for(int i = 0; i < h-1; i++){
        for(int j = 0; j < w-1; j++){
            if(s[i][j] == 'J'){
                int l = 0;
                for(int e = 0; e < w; e++){
                    if(s[i][e] == 'O'){
                        l = e;
                        if(j < l){
                            int k = 0;
                            for(int x = 0; x < h; x++){
                                if(s[x][j] == 'I'){
                                    k = x;
                                    if(i < k && j < l){
                                        qt++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << qt << "\n";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...