結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー polyesterpolyester
提出日時 2020-09-11 23:25:06
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,149 bytes
コンパイル時間 3,081 ms
コンパイル使用メモリ 104,392 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-27 17:03:22
合計ジャッジ時間 4,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> s(n), t(n);
  for(int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> t[i];
  }
  int maxS = *max_element(s.begin(), s.end());
  int maxT = *max_element(t.begin(), t.end());
  if(maxS == 2 && maxT == 2) {
    cout << 2 * n - 1 << endl;
  } else if(maxS == 2) {
    int sum = 0;
    for(int i = 0; i < n; i++) {
      if(s[i] == 1) {
        sum++;
      }
    }
    cout << sum + n << endl;
  } else if(maxT == 2) {
    int sum = 0;
    for(int i = 0; i < n; i++) {
      if(t[i] == 1) {
        sum++;
      }
    }
    cout << sum + n << endl;
  } else {
    int ans = 0, sum = 0;
    for(int i = 0; i < n; i++) {
      sum += s[i];
    }
    ans = max(ans, sum);
    sum = 0;
    for(int i = 0; i < n; i++) {
      sum += t[i];
    }
    ans = max(ans, sum);
    cout << ans << endl;
  }

  return 0;
}
0