結果
問題 |
No.5005 3-SAT
|
ユーザー |
👑 ![]() |
提出日時 | 2022-04-29 14:34:07 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,840 bytes |
コンパイル時間 | 947 ms |
実行使用メモリ | 6,952 KB |
スコア | 2,306 |
最終ジャッジ日時 | 2022-04-29 14:34:13 |
合計ジャッジ時間 | 6,275 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <array> #include <atcoder/modint> using namespace std; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i<(int)(n); i++) using m32 = atcoder::static_modint<998244353>; const int N = 2048; const int BIT_SIZE = 256; struct Constraint{ pair<int,int> a[3]; }; vector<array<array<int, 2>, 3>> A; int main(){ A.resize(N); rep(i,N) rep(c,2) rep(t,3) cin >> A[i][t][c]; rep(i,N) rep(t,3) A[i][t][0] = BIT_SIZE - 1 - A[i][t][0]; rep(i,N) sort(A[i].begin(), A[i].end()); rep(i,N) rep(t,2){ if(A[i][t][0] == A[i][t+1][0] && A[i][t][1] != A[i][t+1][1]){ A[i][t][0] = A[i][t+1][0] = BIT_SIZE; A[i][t][1] = A[i][t+1][1] = -1; } } int final_score = -1; vector<int> final_ans = vector<int>(BIT_SIZE, 0); rep(t,1000){ vector<int> ans; ans.assign(BIT_SIZE + 1, -1); int score = N; rep(i,N){ bool ok = false; rep(t,3) if(ans[A[i][t][0]] == A[i][t][1]) ok = true; if(ok) break; rep(t,3) if(ans[A[i][t][0]] == -1){ ans[A[i][t][0]] = A[i][t][1]; ok = true; break; } if(!ok){ score = i; break; } } if(final_score < score){ final_score = score; final_ans = move(ans); } } rep(i,BIT_SIZE) if(final_ans[i] == -1) final_ans[i] = 0; rep(i,BIT_SIZE) cout << final_ans[i]; cout << endl; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;