結果

問題 No.182 新規性の虜
コンテスト
ユーザー Himatsubushin
提出日時 2022-03-04 11:20:40
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 497 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 187 ms
コンパイル使用メモリ 38,976 KB
最終ジャッジ日時 2026-02-22 08:50:45
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int i, j, n, f, c, a[100001];
  
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);

  c = 0;
  for (i = 0; i < n - 1; i++) {
    f = 0;
    if (a[i] != 0) {
      for (j = i + 1; j < n; j++) {
        if (a[i] == a[j]) {
          a[j] = 0;
          f = 1;
        }
      }
      if (f > 0)
        a[i] = 0;
      else
        c++;
    }
  }
  if (a[n-1] != 0) c++;
  
  printf("%d\n", c);

  return EXIT_SUCCESS;
}
0