結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー |
![]() |
提出日時 | 2020-10-28 00:13:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 464 bytes |
コンパイル時間 | 2,006 ms |
コンパイル使用メモリ | 195,460 KB |
最終ジャッジ日時 | 2025-01-15 16:06:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> s(n), t(n); for(auto &e : s) cin >> e; for(auto &e : t) cin >> e; int s2 = count(s.begin(), s.end(), 2); int t2 = count(t.begin(), t.end(), 2); int ans = s2 * n + t2 * (n - s2); int s1 = t2 ? 0 : count(s.begin(), s.end(), 1); int t1 = s2 ? 0 : count(t.begin(), t.end(), 1); ans += max(s1, t1); cout << ans << '\n'; return 0; }