結果
| 問題 |
No.1225 I hate I hate Matrix Construction
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2020-09-11 21:54:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,166 bytes |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 159,580 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 11:49:29 |
| 合計ジャッジ時間 | 3,561 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 35 |
ソースコード
/**
* @FileName a.cpp
* @Author kanpurin
* @Created 2020.09.11 21:54:18
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int n;cin >> n;
vector<int> s(n),t(n);
int s_0 = 0;
int s_2 = 0;
int t_0 = 0;
int t_2 = 0;
for (int i = 0; i < n; i++) {
cin >> s[i];
if (s[i] == 0) s_0++;
else if (s[i] == 2) s_2++;
}
for (int i = 0; i < n; i++) {
cin >> t[i];
if (t[i] == 0) t_0++;
else if (t[i] == 2) t_2++;
}
if (s_0 > 0 && s_2 > 0) {
cout << s_2 * n + n - (s_2 + s_0) << endl;
}
else if (s_2 > 0 && t_2 > 0) {
cout << (s_2 + t_2) * n - s_2 * t_2 << endl;
}
else if (s_0 > 0 && t_0 > 0) {
cout << n - min(s_0,t_0) << endl;
}
else if (t_0 > 0 && t_2 > 0) {
cout << t_2 * n + n - (t_2 + t_0) << endl;
}
else if (s_0 > 0 || t_0 > 0) {
cout << n << endl;
}
else if (s_2 > 0) {
cout << s_2 * n + n - s_2 << endl;
}
else if (t_2 > 0) {
cout << t_2 * n + n - t_2 << endl;
}
else {
cout << n << endl;
}
return 0;
}
🍮かんプリン