結果
| 問題 |
No.1377 Half xor Half
|
| コンテスト | |
| ユーザー |
wotsushi
|
| 提出日時 | 2020-11-07 22:14:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 679 bytes |
| コンパイル時間 | 1,942 ms |
| コンパイル使用メモリ | 195,512 KB |
| 最終ジャッジ日時 | 2025-01-15 21:34:23 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 46 |
ソースコード
#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;
}
}
}
wotsushi