結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 🍮かんプリン
提出日時 2020-09-11 21:49:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 1,759 ms
コンパイル使用メモリ 159,708 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-27 11:17:30
合計ジャッジ時間 2,819 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.09.11 21:42:15
**/

#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 (t_0 > 0 && t_2 > 0) {
        cout << t_2 * n + n - (t_2 + t_0) << endl;
    }
    else if (s_2 > 0 && t_2 > 0) {
        cout << (s_2 + t_2) * (n - 1) << endl;
    }
    else if (s_0 > 0) {
        cout << n - min(s_0,t_0) << endl;
    }
    else if (s_2 > 0) {
        cout << s_2 * n + n - s_2 << endl;
    }
    else if (t_0 > 0) {
        cout << n - min(s_0,t_0) << endl;
    }
    else if (t_2 > 0) {
        cout << t_2 * n + n - t_2 << endl;
    }
    else {
        cout << n << endl;
    }
    return 0;
}
0