結果

問題 No.1377 Half xor Half
ユーザー 👑 NachiaNachia
提出日時 2021-02-05 21:50:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 887 bytes
コンパイル時間 2,847 ms
コンパイル使用メモリ 206,312 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 08:01:19
合計ジャッジ時間 7,974 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1 ms
4,380 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
4,376 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 2 ms
4,380 KB
testcase_46 WA -
testcase_47 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}

0