結果

問題 No.182 新規性の虜
ユーザー monburan_0401monburan_0401
提出日時 2018-09-04 23:23:24
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 1,435 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 29,952 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-04-24 06:26:04
合計ジャッジ時間 11,367 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 4,106 ms
5,376 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
evil01.txt -- -
evil02.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
	int N;		//	number of words. 1 <=N <= (10^5)
	int A[100000];		//	boxes(each number). 1 <= A[i] <= (10^9)
	int same = 0;		//	number of same words
	int count = 0;		//	
	int change;
	
	scanf("%d",&N);
	for(int i = 0;i < N;i++){
		scanf("%d",&A[i]);
	}
	
	//	printf("%d",A[0]);		//	check OK
	
/*	for(int j = 0;j < N;j++){
		for(int k = 0;k < N;k++){
			if(k == j){
				continue;
			}
			if(A[j] == A[k]){
				same += 1;
			}
		}
		if(same == 0){
			count += 1;
		}
		same = 0;
	}
*/
	// 昇順に並べ替え
	for(int i = 0; i < N; i++){
		for(int j = i; j < N; j++){
			if(A[i] > A[j]){
				change = A[i];
				A[i] = A[j];
				A[j] = change;
			}
		}
	}
	
	// check ok
/*	for(int i = 0; i < N; i++){
		printf("%d ",A[i]);
	}
	printf("\n");
*/
	
	// 違う数が出るまで比べる
	count = 1;		//	その数の数え始め。始めの一歩
	int total = N;		//	全文字数
	int i = 0;
	int j = 1;		//	最初は2番目から比べる
	
	while(i < N){
		while(A[i] == A[j]){
			count += 1;
			j += 1;
			if(j == N){
				break;		//	一番最後まで比べたら終了
			}
		}
		if(count != 1){		//	同じ数字が1つ以上あった時
			total -= count;			//	個数分引く
		}
		count = 1;			//	次の数を数える準備
		i = j;		//	A[i] != A[j]となった時の j から始める
		j += 1;		//	その次から比べる
	}
	
	printf("%d\n",total);
	//printf("%d\n",count);
	
	return 0;
}
0