結果
問題 | No.5005 3-SAT |
ユーザー | umezo |
提出日時 | 2022-04-29 17:41:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,803 ms / 2,000 ms |
コード長 | 2,263 bytes |
コンパイル時間 | 2,297 ms |
実行使用メモリ | 5,164 KB |
スコア | 88,547 |
最終ジャッジ日時 | 2022-04-29 17:44:55 |
合計ジャッジ時間 | 189,204 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,802 ms
3,576 KB |
testcase_01 | AC | 1,803 ms
3,568 KB |
testcase_02 | AC | 1,802 ms
3,612 KB |
testcase_03 | AC | 1,803 ms
3,660 KB |
testcase_04 | AC | 1,802 ms
3,628 KB |
testcase_05 | AC | 1,803 ms
3,508 KB |
testcase_06 | AC | 1,803 ms
3,656 KB |
testcase_07 | AC | 1,801 ms
3,700 KB |
testcase_08 | AC | 1,802 ms
3,656 KB |
testcase_09 | AC | 1,803 ms
3,660 KB |
testcase_10 | AC | 1,803 ms
3,572 KB |
testcase_11 | AC | 1,802 ms
3,512 KB |
testcase_12 | AC | 1,802 ms
3,696 KB |
testcase_13 | AC | 1,802 ms
3,608 KB |
testcase_14 | AC | 1,803 ms
3,644 KB |
testcase_15 | AC | 1,802 ms
3,604 KB |
testcase_16 | AC | 1,803 ms
3,576 KB |
testcase_17 | AC | 1,803 ms
3,604 KB |
testcase_18 | AC | 1,802 ms
3,752 KB |
testcase_19 | AC | 1,802 ms
3,560 KB |
testcase_20 | AC | 1,803 ms
3,564 KB |
testcase_21 | AC | 1,803 ms
3,608 KB |
testcase_22 | AC | 1,802 ms
3,576 KB |
testcase_23 | AC | 1,803 ms
3,616 KB |
testcase_24 | AC | 1,802 ms
3,560 KB |
testcase_25 | AC | 1,802 ms
3,672 KB |
testcase_26 | AC | 1,803 ms
3,748 KB |
testcase_27 | AC | 1,803 ms
3,748 KB |
testcase_28 | AC | 1,803 ms
3,660 KB |
testcase_29 | AC | 1,802 ms
3,648 KB |
testcase_30 | AC | 1,802 ms
3,656 KB |
testcase_31 | AC | 1,802 ms
3,520 KB |
testcase_32 | AC | 1,803 ms
3,576 KB |
testcase_33 | AC | 1,803 ms
3,584 KB |
testcase_34 | AC | 1,802 ms
3,644 KB |
testcase_35 | AC | 1,803 ms
3,668 KB |
testcase_36 | AC | 1,803 ms
3,556 KB |
testcase_37 | AC | 1,803 ms
3,696 KB |
testcase_38 | AC | 1,801 ms
3,612 KB |
testcase_39 | AC | 1,802 ms
3,644 KB |
testcase_40 | AC | 1,802 ms
3,656 KB |
testcase_41 | AC | 1,803 ms
3,612 KB |
testcase_42 | AC | 1,803 ms
3,644 KB |
testcase_43 | AC | 1,803 ms
3,576 KB |
testcase_44 | AC | 1,802 ms
3,652 KB |
testcase_45 | AC | 1,803 ms
3,664 KB |
testcase_46 | AC | 1,803 ms
3,580 KB |
testcase_47 | AC | 1,803 ms
3,612 KB |
testcase_48 | AC | 1,803 ms
3,512 KB |
testcase_49 | AC | 1,803 ms
3,660 KB |
testcase_50 | AC | 1,802 ms
3,752 KB |
testcase_51 | AC | 1,802 ms
3,588 KB |
testcase_52 | AC | 1,803 ms
3,748 KB |
testcase_53 | AC | 1,803 ms
4,904 KB |
testcase_54 | AC | 1,803 ms
4,904 KB |
testcase_55 | AC | 1,803 ms
4,904 KB |
testcase_56 | AC | 1,802 ms
4,904 KB |
testcase_57 | AC | 1,803 ms
5,160 KB |
testcase_58 | AC | 1,802 ms
5,164 KB |
testcase_59 | AC | 1,802 ms
4,900 KB |
testcase_60 | AC | 1,803 ms
5,160 KB |
testcase_61 | AC | 1,803 ms
4,904 KB |
testcase_62 | AC | 1,802 ms
4,900 KB |
testcase_63 | AC | 1,803 ms
4,904 KB |
testcase_64 | AC | 1,802 ms
5,160 KB |
testcase_65 | AC | 1,803 ms
5,160 KB |
testcase_66 | AC | 1,802 ms
4,904 KB |
testcase_67 | AC | 1,803 ms
4,904 KB |
testcase_68 | AC | 1,803 ms
4,900 KB |
testcase_69 | AC | 1,801 ms
4,900 KB |
testcase_70 | AC | 1,803 ms
4,900 KB |
testcase_71 | AC | 1,802 ms
4,900 KB |
testcase_72 | AC | 1,803 ms
4,904 KB |
testcase_73 | AC | 1,803 ms
5,160 KB |
testcase_74 | AC | 1,802 ms
5,160 KB |
testcase_75 | AC | 1,802 ms
4,904 KB |
testcase_76 | AC | 1,802 ms
4,900 KB |
testcase_77 | AC | 1,803 ms
4,904 KB |
testcase_78 | AC | 1,803 ms
4,904 KB |
testcase_79 | AC | 1,802 ms
4,904 KB |
testcase_80 | AC | 1,802 ms
4,904 KB |
testcase_81 | AC | 1,802 ms
4,908 KB |
testcase_82 | AC | 1,803 ms
4,904 KB |
testcase_83 | AC | 1,803 ms
4,900 KB |
testcase_84 | AC | 1,802 ms
5,160 KB |
testcase_85 | AC | 1,803 ms
4,900 KB |
testcase_86 | AC | 1,802 ms
5,164 KB |
testcase_87 | AC | 1,802 ms
4,904 KB |
testcase_88 | AC | 1,803 ms
4,904 KB |
testcase_89 | AC | 1,802 ms
4,900 KB |
testcase_90 | AC | 1,803 ms
4,904 KB |
testcase_91 | AC | 1,802 ms
4,904 KB |
testcase_92 | AC | 1,802 ms
5,160 KB |
testcase_93 | AC | 1,802 ms
5,160 KB |
testcase_94 | AC | 1,803 ms
5,160 KB |
testcase_95 | AC | 1,803 ms
4,900 KB |
testcase_96 | AC | 1,803 ms
5,156 KB |
testcase_97 | AC | 1,802 ms
4,908 KB |
testcase_98 | AC | 1,803 ms
4,900 KB |
testcase_99 | AC | 1,802 ms
4,900 KB |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; using namespace chrono; const int MAX=2048; static uint32_t randXor(){ static uint32_t x=123456789; static uint32_t y=362436069; static uint32_t z=521288629; static uint32_t w=88675123; uint32_t t; t=x^(x<<11); x=y;y=z;z=w; return w=(w^(w>>19))^(t^(t>>8)); } static double rand01(){ return (randXor()+0.5)*(1.0/UINT_MAX); } int calc(vector<int>&A,vector<int>&B,vector<int>&C,vector<int>&P,vector<int>&Q,vector<int>&R,vector<int>&S){ int num=0; rep(i,MAX){ bool b=false; if(S[A[i]]==P[i]) b=true; if(S[B[i]]==Q[i]) b=true; if(S[C[i]]==R[i]) b=true; if(b) num++; else break; } return num; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); vector<int> A(MAX),B(MAX),C(MAX),P(MAX),Q(MAX),R(MAX); vector<int> A0,A1,B0,B1,C0,C1; rep(i,MAX){ cin>>A[i]>>B[i]>>C[i]>>P[i]>>Q[i]>>R[i]; if(P[i]==0) A0.push_back(i); else A1.push_back(i); if(Q[i]==0) B0.push_back(i); else B1.push_back(i); if(R[i]==0) C0.push_back(i); else C1.push_back(i); } A0.push_back(MAX),A1.push_back(MAX),B0.push_back(MAX); B1.push_back(MAX),C0.push_back(MAX),C1.push_back(MAX); auto startClock=system_clock::now(); int bestscore=0; vector<int> S(256),bestS(256); const static double START_TEMP=1500; const static double END_TEMP = 100; const static double END_TIME=1.8; double time=0.0; do{ const double progressRatio=time/END_TIME; const double temp=START_TEMP+(END_TEMP-START_TEMP)*progressRatio; int score=-1; rep(i,2048){ if(S[A[i]]==P[i] || S[B[i]]==Q[i] || S[C[i]]==R[i]) continue; else{ score=i; break; } } if(score>bestscore){ bestscore=score; bestS=S; } ll t=randXor(); if(t%3==0) S[A[score]]^=1; else if(t%3==1) S[B[score]]^=1; else S[C[score]]^=1; time=(duration_cast<microseconds>(system_clock::now()-startClock).count()*1e-6); }while(time<END_TIME); for(int i=255;i>=0;i--) cout<<bestS[i]; cout<<endl; cout<<calc(A,B,C,P,Q,R,bestS)<<endl; return 0; }