답안 #714467

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
714467 2023-03-24T14:56:46 Z Ninedesu Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
1 ms 536 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;
vector<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.push_back(y);
        j.push_back(x);
      }
      else if(arr[y][x]=='O'){
        i.push_back(y);
        l.push_back(x);
      }
      else if(arr[y][x]=='I'){
        k.push_back(y);
        j.push_back(x);
      }
    }
  }
  for(int kk:k){
    for(int ll:l){
      for(int ii:i){
        if(arr[ii][ll]=='O'&&!vis[ii][ll]){
          for(int jj:j){
            if(arr[kk][jj]=='I'&&!vis[kk][jj]){
              if(arr[ii][jj]=='J'&&ii>=jj){
                vis[ii][jj]=true;vis[ii][ll]=true;
                vector<int>chk;
                chk.push_back(ii);chk.push_back(jj);chk.push_back(kk);chk.push_back(ll);
                if(!mp[chk]){
                  cnt++;
                  mp[chk]=true;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << cnt;

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 536 KB Output is correct
3 Correct 1 ms 416 KB Output is correct
4 Incorrect 1 ms 420 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 536 KB Output is correct
3 Correct 1 ms 416 KB Output is correct
4 Incorrect 1 ms 420 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 536 KB Output is correct
3 Correct 1 ms 416 KB Output is correct
4 Incorrect 1 ms 420 KB Output isn't correct
5 Halted 0 ms 0 KB -