結果

問題 No.1377 Half xor Half
コンテスト
ユーザー wotsushi
提出日時 2020-11-07 22:14:18
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
+ 618µs
コード長 679 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,285 ms
コンパイル使用メモリ 218,344 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-11-01 19:17:07
合計ジャッジ時間 4,423 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  string S, T;
  cin >> S;
  cin >> T;
  vector<int> x(N), y(N);
  for (int i = 0; i < N; ++i) {
    x[i] = 2 * (S[i] - '0') + (S[i + N] - '0');
    y[i] = 2 * (T[i] - '0') + (T[i + N] - '0');
    if (x[i] == 0 xor y[i] == 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << 2 * N << endl;
  for (int i = 0; i < N; ++i) {
    int m = (y[i] - x[i] + 3) % 3;
    if (m == 0) {
      cout << i << endl;
      cout << i << endl;
    } else if (m == 1) {
      cout << i << endl;
      cout << i + 1 << endl;
    } else {
      cout << i + 1 << endl;
      cout << i << endl;
    }
  }
}
0