結果
問題 | No.5013 セクスタプル (open) |
ユーザー | merom686 |
提出日時 | 2022-12-29 15:36:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 2,946 bytes |
コンパイル時間 | 1,981 ms |
実行使用メモリ | 3,668 KB |
スコア | 12,698 |
最終ジャッジ日時 | 2022-12-29 15:37:11 |
合計ジャッジ時間 | 17,474 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 103 ms
3,524 KB |
testcase_01 | AC | 102 ms
3,528 KB |
testcase_02 | AC | 104 ms
3,372 KB |
testcase_03 | AC | 103 ms
3,480 KB |
testcase_04 | AC | 102 ms
3,384 KB |
testcase_05 | AC | 103 ms
3,384 KB |
testcase_06 | AC | 102 ms
3,380 KB |
testcase_07 | AC | 103 ms
3,384 KB |
testcase_08 | AC | 103 ms
3,428 KB |
testcase_09 | AC | 103 ms
3,540 KB |
testcase_10 | AC | 102 ms
3,448 KB |
testcase_11 | AC | 103 ms
3,492 KB |
testcase_12 | AC | 102 ms
3,540 KB |
testcase_13 | AC | 103 ms
3,380 KB |
testcase_14 | AC | 103 ms
3,532 KB |
testcase_15 | AC | 104 ms
3,376 KB |
testcase_16 | AC | 102 ms
3,508 KB |
testcase_17 | AC | 105 ms
3,444 KB |
testcase_18 | AC | 103 ms
3,528 KB |
testcase_19 | AC | 102 ms
3,504 KB |
testcase_20 | AC | 103 ms
3,488 KB |
testcase_21 | AC | 102 ms
3,528 KB |
testcase_22 | AC | 102 ms
3,376 KB |
testcase_23 | AC | 103 ms
3,452 KB |
testcase_24 | AC | 102 ms
3,528 KB |
testcase_25 | AC | 104 ms
3,504 KB |
testcase_26 | AC | 102 ms
3,452 KB |
testcase_27 | AC | 102 ms
3,536 KB |
testcase_28 | AC | 102 ms
3,400 KB |
testcase_29 | AC | 102 ms
3,532 KB |
testcase_30 | AC | 103 ms
3,376 KB |
testcase_31 | AC | 102 ms
3,432 KB |
testcase_32 | AC | 103 ms
3,376 KB |
testcase_33 | AC | 102 ms
3,668 KB |
testcase_34 | AC | 104 ms
3,500 KB |
testcase_35 | AC | 104 ms
3,448 KB |
testcase_36 | AC | 102 ms
3,508 KB |
testcase_37 | AC | 102 ms
3,452 KB |
testcase_38 | AC | 103 ms
3,476 KB |
testcase_39 | AC | 103 ms
3,444 KB |
testcase_40 | AC | 102 ms
3,620 KB |
testcase_41 | AC | 102 ms
3,384 KB |
testcase_42 | AC | 103 ms
3,532 KB |
testcase_43 | AC | 102 ms
3,524 KB |
testcase_44 | AC | 103 ms
3,532 KB |
testcase_45 | AC | 102 ms
3,480 KB |
testcase_46 | AC | 103 ms
3,444 KB |
testcase_47 | AC | 102 ms
3,532 KB |
testcase_48 | AC | 102 ms
3,384 KB |
testcase_49 | AC | 104 ms
3,452 KB |
testcase_50 | AC | 104 ms
3,500 KB |
testcase_51 | AC | 102 ms
3,384 KB |
testcase_52 | AC | 103 ms
3,444 KB |
testcase_53 | AC | 103 ms
3,504 KB |
testcase_54 | AC | 104 ms
3,428 KB |
testcase_55 | AC | 102 ms
3,444 KB |
testcase_56 | AC | 102 ms
3,484 KB |
testcase_57 | AC | 102 ms
3,540 KB |
testcase_58 | AC | 102 ms
3,448 KB |
testcase_59 | AC | 103 ms
3,376 KB |
testcase_60 | AC | 102 ms
3,524 KB |
testcase_61 | AC | 102 ms
3,452 KB |
testcase_62 | AC | 102 ms
3,540 KB |
testcase_63 | AC | 103 ms
3,508 KB |
testcase_64 | AC | 103 ms
3,500 KB |
testcase_65 | AC | 102 ms
3,424 KB |
testcase_66 | AC | 102 ms
3,452 KB |
testcase_67 | AC | 103 ms
3,444 KB |
testcase_68 | AC | 101 ms
3,444 KB |
testcase_69 | AC | 103 ms
3,532 KB |
testcase_70 | AC | 104 ms
3,444 KB |
testcase_71 | AC | 103 ms
3,444 KB |
testcase_72 | AC | 102 ms
3,380 KB |
testcase_73 | AC | 103 ms
3,380 KB |
testcase_74 | AC | 103 ms
3,500 KB |
testcase_75 | AC | 104 ms
3,432 KB |
testcase_76 | AC | 103 ms
3,532 KB |
testcase_77 | AC | 103 ms
3,532 KB |
testcase_78 | AC | 103 ms
3,620 KB |
testcase_79 | AC | 102 ms
3,448 KB |
testcase_80 | AC | 104 ms
3,484 KB |
testcase_81 | AC | 102 ms
3,540 KB |
testcase_82 | AC | 102 ms
3,484 KB |
testcase_83 | AC | 102 ms
3,452 KB |
testcase_84 | AC | 102 ms
3,616 KB |
testcase_85 | AC | 102 ms
3,380 KB |
testcase_86 | AC | 103 ms
3,500 KB |
testcase_87 | AC | 102 ms
3,384 KB |
testcase_88 | AC | 104 ms
3,376 KB |
testcase_89 | AC | 103 ms
3,448 KB |
testcase_90 | AC | 103 ms
3,484 KB |
testcase_91 | AC | 103 ms
3,444 KB |
testcase_92 | AC | 102 ms
3,484 KB |
testcase_93 | AC | 102 ms
3,452 KB |
testcase_94 | AC | 103 ms
3,376 KB |
testcase_95 | AC | 103 ms
3,620 KB |
testcase_96 | AC | 102 ms
3,448 KB |
testcase_97 | AC | 104 ms
3,376 KB |
testcase_98 | AC | 102 ms
3,532 KB |
testcase_99 | AC | 102 ms
3,484 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { auto t0 = chrono::high_resolution_clock::now(); constexpr int N = 6; int a[2][N] = {}, b[N * N] = {}; ll b1[N * N] = {}; array<int, N * N> d; int v = -1; int q = N * N; mt19937_64 rnd; for (int k = 0; k < q; k++) { int t = 0; ll s = 0; for (int i = 0; i < N; i++) { int d; cin >> d; d--; t |= 1 << d; s += 1 << d * 8; } b[k] = ~t; b1[k] = s; } for (int l = 0;; l++) { if (l % 256 == 0) { auto t1 = chrono::high_resolution_clock::now(); if (chrono::duration_cast<chrono::milliseconds>(t1 - t0).count() >= 100) { //cout << l << endl; //cout << v << endl; break; } } ll p[N][N] = {}; array<int, N * N> c; for (int h = 0; h < 2; h++) { for (int i = 0; i < N; i++) { a[h][i] = (1 << N) - 1; } } for (int k = 0; k < q; k++) { int t = b[k]; int i1 = -1, j1 = -1, u = 1 << 30; if (k < 10) { while (1) { i1 = rnd() % N; j1 = rnd() % N; if (p[i1][j1] == 0) break; } } else { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (p[i][j] == 0) { int s = (__builtin_popcount(a[0][i] & t) + __builtin_popcount(a[1][j] & t)) * 1024 - __builtin_popcount(a[0][i]) - __builtin_popcount(a[1][j]); if (s < u) { u = s; i1 = i; j1 = j; } } } } } c[k] = i1 * N + j1; p[i1][j1] = b1[k]; a[0][i1] &= ~t; a[1][j1] &= ~t; } int s = 0; for (int i = 0; i < N; i++) { ll t = 0; for (int j = 0; j < N; j++) { t += p[i][j]; } for (int h = 0; h < 6; h++) { if (a[0][i] >> h & 1) s += (t >> h * 8 & 0xff) - 3; } } for (int j = 0; j < N; j++) { ll t = 0; for (int i = 0; i < N; i++) { t += p[i][j]; } for (int h = 0; h < 6; h++) { if (a[1][j] >> h & 1) s += (t >> h * 8 & 0xff) - 3; } } if (s > v) { v = s; d = c; } } for (int k = 0; k < q; k++) { int i = d[k] / N; int j = d[k] % N; cout << i + 1 << ' ' << j + 1 << endl; } return 0; }