提出 #66302828


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int main()
{
	scanf("%d",&n);
	a.resize(n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a.begin(),a.end());
	a.erase(unique(a.begin(),a.end()),a.end());
	printf("%d\n",a.size());
	for(int &x:a) printf("%d ",x);
	return 0;
}

提出情報

提出日時
問題 B - Compression
ユーザ wuyuhang323
言語 C++ 20 (gcc 12.2)
得点 150
コード長 311 Byte
結果 AC
実行時間 1 ms
メモリ 3876 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:13:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   13 |         printf("%d\n",a.size());
      |                 ~^    ~~~~~~~~
      |                  |          |
      |                  int        std::vector<int>::size_type {aka long unsigned int}
      |                 %ld
Main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
Main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 150 / 150
結果
AC × 3
AC × 21
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3684 KiB
00_sample_01.txt AC 1 ms 3748 KiB
00_sample_02.txt AC 1 ms 3868 KiB
01_random_00.txt AC 1 ms 3752 KiB
01_random_01.txt AC 1 ms 3748 KiB
01_random_02.txt AC 1 ms 3624 KiB
01_random_03.txt AC 1 ms 3876 KiB
01_random_04.txt AC 1 ms 3872 KiB
01_random_05.txt AC 1 ms 3756 KiB
01_random_06.txt AC 1 ms 3760 KiB
01_random_07.txt AC 1 ms 3624 KiB
01_random_08.txt AC 1 ms 3624 KiB
01_random_09.txt AC 1 ms 3636 KiB
01_random_10.txt AC 1 ms 3584 KiB
01_random_11.txt AC 1 ms 3612 KiB
01_random_12.txt AC 1 ms 3612 KiB
01_random_13.txt AC 1 ms 3804 KiB
01_random_14.txt AC 1 ms 3752 KiB
01_random_15.txt AC 1 ms 3752 KiB
01_random_16.txt AC 1 ms 3768 KiB
01_random_17.txt AC 1 ms 3580 KiB