제출 #714467

#제출 시각아이디문제언어결과실행 시간메모리
714467NinedesuBitaro the Brave (JOI19_ho_t1)C++14
0 / 100
1 ms536 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...