結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-09-28 18:53:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 474 bytes |
| コンパイル時間 | 1,326 ms |
| コンパイル使用メモリ | 167,736 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-02 09:07:21 |
| 合計ジャッジ時間 | 2,542 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
int N; cin >> N;
int S[3] = {}, T[3] = {};
rep(i, N) { int s; cin >> s; S[s]++; }
rep(i, N) { int s; cin >> s; T[s]++; }
int ans = 0;
ans += S[2] * N + T[2] * N - S[2] * T[2];
int tmp = 0;
if (S[2] == 0) tmp = max(tmp, T[1]);
if (T[2] == 0) tmp = max(tmp, S[1]);
ans += tmp;
cout << ans << endl;
return 0;
}
Nachia