結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー |
![]() |
提出日時 | 2020-09-11 22:33:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 685 bytes |
コンパイル時間 | 2,141 ms |
コンパイル使用メモリ | 194,208 KB |
最終ジャッジ日時 | 2025-01-14 10:52:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair<int,int> P; int main() { int n; cin >> n; vector<int> s(n), t(n); rep(i,n) cin >> s[i]; rep(i,n) cin >> t[i]; int cs = 0, ct = 0; int os = 0, ot = 0; for (int i = 0; i < n; i++) { if (s[i] == 1) cs++; if (s[i] == 2) os++; if (t[i] == 1) ct++; if (t[i] == 2) ot++; } if (!os && !ot) { cout << max(cs, ct) << endl; } else if (os && ot) { cout << (os + ot) * n - os * ot << endl; } else { cout << max(os, ot) * n + (os ? cs : ct) << endl; } return 0; }