結果

問題 No.99 ジャンピング駒
ユーザー lice6613lice6613
提出日時 2019-12-22 15:14:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 71,400 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 08:11:24
合計ジャッジ時間 1,504 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
4,352 KB
testcase_01 AC 40 ms
4,348 KB
testcase_02 AC 41 ms
4,348 KB
testcase_03 AC 41 ms
4,352 KB
testcase_04 AC 40 ms
4,348 KB
testcase_05 AC 40 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = 0; i < N; ++i)
    cin >> X[i];
  for (int i = 0; i < N; ++i)
    X[i] %= 2;
  int zero = 0, one = 0;
  for (int i = 0; i < N; ++i)
    if (X[i] == 0)
      ++zero;
    else
      ++one;
  cout << N - min(zero, one) * 2 << endl;
}
0