結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー bonKotsu
提出日時 2021-05-29 16:44:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 168,000 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 00:08:39
合計ジャッジ時間 2,694 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>

int main() {
  int n;
  cin >> n;
  vector<int> s(n), t(n);
  vector<int> cnts(3), cntt(3);
  rep(i,n) {
    cin >> s[i];
    cnts[s[i]]++;
  }
  rep(i,n) {
    cin >> t[i];
    cntt[t[i]]++;
  }

  int ans = 0;
  if (cnts[2] && cntt[2]) ans =  n*n-cnts[2]*cntt[2];
  else if (cnts[2]) ans = cnts[2]*n+cnts[1];
  else if (cntt[2]) ans = cntt[2]*n+cntt[1];
  else ans = max(cnts[1], cntt[1]);
  cout << ans << endl;

}
0