結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー mikianaaa
提出日時 2020-09-12 15:54:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 866 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 166,188 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 04:39:40
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)n - 1; i > -1; i--)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> S(N), T(N);
    vector<vector<int>> mat(N, vector<int>(N, 0));

    int cnt = 0, tmp1 = 0, tmp2 = 0;

    rep(i, N) {
        cin >> S[i];
        if (S[i] == 2) {
            cnt += N;
        }
        if (S[i] == 1)
            tmp1++;
    }

    rep(i, N) {
        cin >> T[i];
        if (T[i] == 2) {
            cnt += N;
        }
        if (T[i] == 1)
            tmp2++;
    }

    cnt += min(tmp1, tmp2);
    cout << cnt << endl;
}
0