結果
問題 |
No.1225 I hate I hate Matrix Construction
|
ユーザー |
![]() |
提出日時 | 2020-11-06 16:51:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 645 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 69,760 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-22 11:49:19 |
合計ジャッジ時間 | 1,514 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main(){ int N; cin >> N; vector<int> S(N); for (int i = 0; i < N; i++){ cin >> S[i]; } vector<int> T(N); for (int i = 0; i < N; i++){ cin >> T[i]; } vector<int> A(3, 0); for (int i = 0; i < N; i++){ A[S[i]]++; } vector<int> B(3, 0); for (int i = 0; i < N; i++){ B[T[i]]++; } if (A[2] > 0 && B[2] > 0){ cout << N * (A[2] + B[2]) - A[2] * B[2] << endl; } if (A[2] > 0 && B[2] == 0){ cout << N * A[2] + A[1] << endl; } if (A[2] == 0 && B[2] > 0){ cout << N * B[2] + B[1] << endl; } if (A[2] == 0 && B[2] == 0){ cout << max(A[1], B[1]) << endl; } }