結果
問題 | No.452 横着者のビンゴゲーム |
ユーザー |
|
提出日時 | 2020-03-04 14:22:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,031 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 78,288 KB |
実行使用メモリ | 13,632 KB |
最終ジャッジ日時 | 2024-10-14 00:14:16 |
合計ジャッジ時間 | 5,733 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 TLE * 1 -- * 29 |
コンパイルメッセージ
main.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 28 | main() | ^~~~
ソースコード
#include<iostream>#include<vector>#include<algorithm>using namespace std;int N,M;int A[200][100][100];bool f(int K){for(int i=0;i<M;i++)for(int j=i+1;j<M;j++){for(int I=0;I<2*N+2;I++)for(int J=0;J<2*N+2;J++){vector<int>a;if(I<N)for(int k=0;k<N;k++)a.push_back(A[i][I][k]);else if(I<2*N)for(int k=0;k<N;k++)a.push_back(A[i][k][I-N]);else if(I==2*N)for(int k=0;k<N;k++)a.push_back(A[i][k][k]);else for(int k=0;k<N;k++)a.push_back(A[i][N-k-1][k]);if(J<N)for(int k=0;k<N;k++)a.push_back(A[j][J][k]);else if(J<2*N)for(int k=0;k<N;k++)a.push_back(A[j][k][J-N]);else if(J==2*N)for(int k=0;k<N;k++)a.push_back(A[j][k][k]);else for(int k=0;k<N;k++)a.push_back(A[j][N-k-1][k]);sort(a.begin(),a.end());if(unique(a.begin(),a.end())-a.begin()<=K)return true;}}return false;}main(){cin>>N>>M;for(int i=0;i<M;i++)for(int j=0;j<N;j++)for(int k=0;k<N;k++)cin>>A[i][j][k];int L=N-1,R=2*N;while(R-L>1){if(f((L+R)/2))R=(L+R)/2;else L=(L+R)/2;}cout<<L<<endl;}