結果
| 問題 |
No.182 新規性の虜
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-26 17:19:34 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 614 bytes |
| コンパイル時間 | 990 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 08:16:12 |
| 合計ジャッジ時間 | 4,180 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 9 RE * 18 |
コンパイルメッセージ
main.c: In function 'main':
main.c:17:44: warning: iteration 10 invokes undefined behavior [-Waggressive-loop-optimizations]
17 | for (int j = 0; j<hashcount[i]; j++) {
| ~~~~~~~~~^~~
main.c:16:27: note: within this loop
16 | for (int i = 0; i < 11; i++) {
| ~~^~~~
ソースコード
#include<stdio.h>
#define same 1000000001
int main(void) {
int N, count = 0;
int b;
int hash[10][10];
int hashcount[10] = { 0 };
int check;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &b);
hash[b % 10][hashcount[b % 10]] = b;
hashcount[b % 10]++;
}
for (int i = 0; i < 11; i++) {
for (int j = 0; j<hashcount[i]; j++) {
if (hash[i][j] == same) {
continue;
}
check = 1;
for (int k = j + 1; k <= hashcount[i]; k++) {
if (hash[i][j] == hash[i][k]) {
hash[i][k] = same;
check = 0;
}
}
if (check) {
count++;
}
}
}
printf("%d", count);
}