結果
問題 | No.452 横着者のビンゴゲーム |
ユーザー | olphe |
提出日時 | 2016-12-03 05:04:10 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,475 bytes |
コンパイル時間 | 616 ms |
コンパイル使用メモリ | 60,632 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-05-05 17:59:24 |
合計ジャッジ時間 | 16,701 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 4 ms
5,376 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | WA | - |
testcase_14 | AC | 624 ms
5,376 KB |
testcase_15 | AC | 591 ms
5,376 KB |
testcase_16 | AC | 310 ms
5,376 KB |
testcase_17 | AC | 36 ms
5,376 KB |
testcase_18 | AC | 176 ms
5,376 KB |
testcase_19 | AC | 86 ms
5,376 KB |
testcase_20 | AC | 63 ms
5,376 KB |
testcase_21 | AC | 464 ms
5,376 KB |
testcase_22 | WA | - |
testcase_23 | AC | 908 ms
5,376 KB |
testcase_24 | WA | - |
testcase_25 | AC | 23 ms
5,376 KB |
testcase_26 | AC | 500 ms
5,376 KB |
testcase_27 | WA | - |
testcase_28 | AC | 218 ms
5,376 KB |
testcase_29 | WA | - |
testcase_30 | AC | 622 ms
5,376 KB |
testcase_31 | AC | 65 ms
5,376 KB |
testcase_32 | AC | 41 ms
5,376 KB |
testcase_33 | AC | 200 ms
5,376 KB |
testcase_34 | WA | - |
testcase_35 | AC | 115 ms
5,376 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 2,229 ms
5,376 KB |
testcase_39 | AC | 1,385 ms
5,376 KB |
testcase_40 | AC | 1,400 ms
5,376 KB |
testcase_41 | WA | - |
testcase_42 | AC | 1,394 ms
5,376 KB |
testcase_43 | AC | 1,399 ms
5,376 KB |
ソースコード
#include "iostream" #include "algorithm" using namespace std; int N, M; int card[200][100][100]; int ans=1000; int box; int check[2][100]; void same() { int x=0, y=0; box = N; while (x!=N-1&&y!=N-1) { if (check[0][x] == check[1][y]) { box--; if(x<N-1)x++; if(y<N-1)y++; } else if (check[0][x]>check[1][y]) { if(y<N-1)y++; else x++; } else { if(x<N-1)x++; else y++; } } if (ans > box)ans = box; } void _copy(int num,int y,int x,bool flag) { int a=0; if (!flag)a = 1; if (y == -1&&x!=-1) { for (int i = 0; i < N; i++) { check[a][i] = card[num][i][x]; } sort(check[a], &check[a][N]); } else if (x == -1&&y!=-1) { for (int i = 0; i < N; i++) { check[a][i] = card[num][y][i]; } sort(check[a], &check[a][N]); } else if(x==-1&&y==-1){ for (int i = 0; i < N; i++) { check[a][i] = card[num][i][i]; } sort(check[a], &check[a][N]); } else { for (int i = 0; i < N; i++) { check[a][i] = card[num][i][N-i-1]; } sort(check[a], &check[a][N]); } } int 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 >> card[i][j][k]; } } } for (int h = 0; h < M; h++) { for (int i = 0; i < N; i++) { _copy(h, i, -1,true); for (int j = 0; j < M; j++) { if (h != j) { for (int k = 0; k < N; k++) { _copy(j, k, -1,false); same(); _copy(j, -1, k, false); same(); _copy(j, -1, -1, false); same(); _copy(j, 0, 0, false); same(); } } } _copy(h, -1, i, true); for (int j = 0; j < M; j++) { if (h != j) { for (int k = 0; k < N; k++) { _copy(j, k, -1, false); same(); _copy(j, -1, k, false); same(); _copy(j, -1, -1, false); same(); _copy(j, 0, 0, false); same(); } } } } _copy(h, -1, -1, true); for (int j = 0; j < M; j++) { if (h != j) { for (int k = 0; k < N; k++) { _copy(j, k, -1, false); same(); _copy(j, -1, k, false); same(); } _copy(j, -1, -1, false); same(); _copy(j, 0, 0, false); same(); } } _copy(h, 0, 0, true); for (int j = 0; j < M; j++) { if (h != j) { for (int k = 0; k < N; k++) { _copy(j, k, -1, false); same(); _copy(j, -1, k, false); same(); } _copy(j, -1, -1, false); same(); _copy(j, 0, 0, false); same(); } } } cout << ans + N-1 << "\n"; return 0; }