結果

問題 No.99 ジャンピング駒
ユーザー Shawn stayCShawn stayC
提出日時 2020-06-26 00:24:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 626 bytes
コンパイル時間 1,755 ms
コンパイル使用メモリ 170,448 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-16 23:22:27
合計ジャッジ時間 10,303 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(),(x).end()

int main(){
	int n; cin>>n;
	vector<pair<int,int>> vp(n);
	rep(i,n){
		int x; cin>>x;
		vp[i]=make_pair(x,1);
	}
	sort(all(vp));
	bool flg=true;
	while(flg){
		flg=false;
		for(int i=0; i<n; i++){
			if(vp[i].second==0) continue;
			for(int j=i+1; j<n; j++){
				if(vp[j].second==0) continue;
				if((vp[j].first-vp[i].first)%2==1){
					vp[j].second=0;
					vp[i].second=0;
					flg=true;
					break;
				}
			}
		}
	}
	int ans=0;
	for(auto x:vp){
		if(x.second==1) ans++;
	}
	cout << ans << endl;
}
0