結果
問題 | No.1421 国勢調査 (Hard) |
ユーザー | kotatsugame |
提出日時 | 2021-03-11 02:27:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 727 bytes |
コンパイル時間 | 575 ms |
コンパイル使用メモリ | 67,804 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-04-20 19:38:57 |
合計ジャッジ時間 | 4,659 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
10,624 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N,M; int A[10101],Y[10101]; int X[50]; main() { cin>>N>>M; for(int i=0;i<M;i++) { int n;cin>>n; for(;n--;) { int b;cin>>b; A[i]|=1<<b-1; } cin>>Y[i]; } int cur=0; for(int i=0;i<N;i++) { int id=cur; while(id<M&&!(A[id]>>i&1))id++; if(id==M)continue; if(id>cur) { swap(A[id],A[cur]); swap(Y[id],Y[cur]); } for(int j=0;j<M;j++)if(j!=cur&&A[j]>>i&1) { A[j]^=A[cur]; Y[j]^=Y[cur]; } cur++; } for(int i=0;i<M;i++) { if(A[i]) { int id=0; while(A[i]>>id)id++; id--; X[id]=Y[i]; } else { if(Y[i]) { cout<<-1<<endl; return 0; } } } for(int i=0;i<N;i++)cout<<X[i]<<endl; }