結果

問題 No.99 ジャンピング駒
ユーザー ElkElk
提出日時 2018-06-30 22:26:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 598 bytes
コンパイル時間 1,743 ms
コンパイル使用メモリ 169,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 16:25:15
合計ジャッジ時間 4,068 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 261 ms
4,384 KB
testcase_01 AC 260 ms
4,380 KB
testcase_02 AC 248 ms
4,380 KB
testcase_03 AC 157 ms
4,376 KB
testcase_04 AC 49 ms
4,376 KB
testcase_05 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N, i, tmp;
    vector <int> x;

    cin >> N;
    for(i = 0; i < N; i++){
        cin >> tmp;
        x.push_back(tmp);
    }
    sort(x.begin(), x.end());
    for(i = 0; i < N; i++){
        if((x[i + 1] - x[i])%2 != 0){
            x.erase(x.begin() + i, x.begin() + i + 2);

            if(i == 0){
                i -= 1;
            }else{
                i -= 2;
            }
        }
        
        if(i + 1 == x.size())    break;
        if(x.size() == 1)   break;
    }

    cout << x.size() << endl;

    return 0;
}
0