結果

問題 No.99 ジャンピング駒
ユーザー bdisheoshepehabdisheoshepeha
提出日時 2018-12-20 13:51:01
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 640 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 60,072 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-10-26 00:54:46
合計ジャッジ時間 13,289 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<stdlib.h>
int main(){
	int size=0;
	std::cin>>size;
	std::vector<int> flg(size);
	std::vector<int> array(size);
	for(int i=0;i<size;i++){
		std::cin>>array[i];
	}
	int temp=0;
	for(int i=0; i<size; i++){
		for(int j=size-1; j>i; j--){
			if(array[j] < array[j-1]){
				temp = array[j];
		        array[j] = array[j-1];
		        array[j-1] = temp;
		    }
		}
	}

	for(int i=0;i<size;i++){
		if(flg[i]==0){
			int hoge=0;
			hoge=abs(array[i]-array[i+1]);
			if(hoge%2)flg[i]=1;flg[i+1]=1;
		}

	}
	int yuyu=0;
	for(int n=0;n<size;n++){
		if(flg[n]==1)yuyu++;
	}
	printf("%d",yuyu);
	return 0;
}
0