Submission #714473

# Submission time Handle Problem Language Result Execution time Memory
714473 2023-03-24T15:24:38 Z Ninedesu Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
1000 ms 273232 KB
#include<bits/stdc++.h>
using namespace std;

const int N=3001;
int n,m;
int cnt;
bool vis[N][N];
string arr[N],s;
set<int>i,j,k,l;
map<vector<int>,bool>mp;

int main(){
  ios_base::sync_with_stdio(0),cin.tie(0);
  int n,m;
  cin >> n >> m;
  for(int y=1; y<=n; y++){
    cin >> s;
    arr[y]="x"+s;
    for(int x=1; x<=m; x++){
      if(arr[y][x]=='J'){
        i.insert(y);
        j.insert(x);
      }
      else if(arr[y][x]=='O'){
        i.insert(y);
        l.insert(x);
      }
      else if(arr[y][x]=='I'){
        k.insert(y);
        j.insert(x);
      }
    }
  }
  for(int ii:i){
    for(int jj:j){
      if(arr[ii][jj]=='J'){
        for(int ll:l){
          if(arr[ii][ll]=='O'){
            for(int kk:k){
              if(arr[kk][jj]=='I'){
                vector<int>chk;
                chk.push_back(ii);chk.push_back(jj);chk.push_back(kk);chk.push_back(ll);
                if(!mp[chk]&&ii<kk&&jj<ll){
                  cnt++;
                  mp[chk]=true;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << cnt;

  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 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 1106 ms 273232 KB Time limit exceeded
6 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 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 1106 ms 273232 KB Time limit exceeded
6 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 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 1106 ms 273232 KB Time limit exceeded
6 Halted 0 ms 0 KB -