Submission #6518951
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { int N, K; scanf("%d%d", &N, &K); vector<int> buckets(N, 0); for (int i = 0; i < N; i++) { int A; scanf("%d", &A); buckets[A - 1]++; } sort(buckets.begin(), buckets.end(), greater<int>()); int num = 0; for (int i = 0; i < K; i++) { // バケットから大きい順にK種類を取り出した際に、ボールが何個あるか num += buckets[i]; } // 足りない分はボールの整数にかかわらず、書き換える int ans = N - num; printf("%d", ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Not so Diverse |
User | sigu1011 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 609 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:6:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &N, &K); ^ ./Main.cpp:11:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &A); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 1 ms | 256 KB |
10.txt | AC | 24 ms | 1024 KB |
11.txt | AC | 24 ms | 1024 KB |
12.txt | AC | 25 ms | 1024 KB |
13.txt | AC | 22 ms | 896 KB |
2.txt | AC | 1 ms | 256 KB |
3.txt | AC | 24 ms | 1024 KB |
4.txt | AC | 25 ms | 1024 KB |
5.txt | AC | 23 ms | 1024 KB |
6.txt | AC | 22 ms | 896 KB |
7.txt | AC | 21 ms | 896 KB |
8.txt | AC | 23 ms | 1024 KB |
9.txt | AC | 25 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |