Submission #1138207

#TimeUsernameProblemLanguageResultExecution timeMemory
1138207havinaashthenoobBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
1096 ms584 KiB
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;

int main() {
    vector<pair<int, int>>J;
    vector<pair<int, int>>O;
    vector<pair<int, int>>I;
    int h, w, c=0;
    cin >> h >> w;
    vector<string>s(h);
    for(int i=0; i<h; i++){
        cin >> s[i];
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j] == 'J'){
                J.push_back({i, j});
            }
            if(s[i][j] == 'O'){
                O.push_back({i, j});
            }
            if(s[i][j] == 'I'){
                I.push_back({i, j});
            }
        }
    }
    for(int i=0; i<J.size(); i++){
        for(int j=0; j<O.size(); j++){
            for(int k=0; k<I.size(); k++){
                if(J[i].first == O[j].first && J[i].second == I[k].second && J[i].first < I[k].first && J[i].second < O[j].second){
                    c++;
                }
            }
        }
    }
    cout << c;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...