結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-09-11 21:49:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 1,263 ms
コンパイル使用メモリ 145,736 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 13:56:15
合計ジャッジ時間 2,942 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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