結果
問題 |
No.1377 Half xor Half
|
ユーザー |
👑 ![]() |
提出日時 | 2021-02-05 21:47:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,039 bytes |
コンパイル時間 | 1,851 ms |
コンパイル使用メモリ | 202,092 KB |
最終ジャッジ日時 | 2025-01-18 12:11:55 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 14 WA * 32 |
ソースコード
#include <bits/stdc++.h> using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) int N; vector<int> S,T; vector<int> X[4][4]={ { {}, {-1}, {-1}, {-1} }, { {-1}, {}, {0,1}, {1,0} }, { {-1}, {1,0}, {}, {0,1} }, { {-1}, {0,1}, {1,0}, {} } }; vector<int> solve(){ vector<int> res; rep(i,N){ int s=S[i]*2+S[i+N]; int t=T[i]*2+T[i+N]; auto a=X[s][t]; if(a==vector<int>({-1})) return {-1}; for(auto p:a) res.push_back(p+i); } return res; } int main(){ cin>>N; S.resize(N*2); T.resize(N*2); { string Sbuf,Tbuf; cin>>Tbuf>>Sbuf; rep(i,N*2) S[i]=Sbuf[i]-'0'; rep(i,N*2) T[i]=Tbuf[i]-'0'; } bool ok=false; vector<int> ans; rep(t,2){ ans=solve(); if(ans.size()==1 && ans[0]==-1){ rep(i,N) T[i+N]^=T[i]; } else{ if(t) ans.push_back(0); ok=true; break; } } if(!ok) cout<<-1<<endl; else{ cout<<ans.size()<<endl; rep(i,ans.size()) cout<<ans[i]<<endl; } return 0; }