結果

問題 No.99 ジャンピング駒
ユーザー SSRSSSRS
提出日時 2020-08-05 14:55:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 285 bytes
コンパイル時間 566 ms
コンパイル使用メモリ 70,048 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 00:38:34
合計ジャッジ時間 1,810 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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];
	}
	vector<int> cnt(2, 0);
	for (int i = 0; i < N; i++){
		cnt[abs(X[i]) % 2]++;
	}
	cout << N - min(cnt[0], cnt[1]) * 2 << endl;
}
0