結果
| 問題 | No.1377 Half xor Half |
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-02-05 21:50:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 887 bytes |
| 記録 | |
| コンパイル時間 | 2,248 ms |
| コンパイル使用メモリ | 200,496 KB |
| 最終ジャッジ日時 | 2025-01-18 12:14:45 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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';
}
vector<int> ans=solve();
bool ok = ans!=vector<int>({-1});
if(!ok) cout<<-1<<endl;
else{
cout<<ans.size()<<endl;
rep(i,ans.size()) cout<<ans[i]<<endl;
}
return 0;
}
Nachia