結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2020-09-11 21:30:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 715 bytes |
| コンパイル時間 | 2,579 ms |
| コンパイル使用メモリ | 248,800 KB |
| 最終ジャッジ日時 | 2025-01-14 10:03:13 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 31 |
ソースコード
#include <bits/extc++.h>
int main() {
using namespace std;
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n), b(n);
for (auto&& e : a) cin >> e;
for (auto&& e : b) cin >> e;
bool a2 = count(begin(a), end(a), 2);
bool b2 = count(begin(b), end(b), 2);
int res{};
if (a2 and b2) {
res = (a2 + b2) * n - a2 * b2;
} else if (a2 == 0 and b2 == 0) {
res = min(count(begin(a), end(a), 1), count(begin(b), end(b), 1));
} else {
if (b2) {
swap(a2, b2);
swap(a, b);
}
assert(a2 and b2 == 0);
assert(count(begin(b), end(b), 1) == n);
res = a2 * n + count(begin(a), end(a), 1);
}
cout << res << '\n';
}
risujiroh