Submission #1194011
Source Code Expand
#include<bits/stdc++.h> #include<random> #include<unordered_map> #include<unordered_set> using namespace std; #define MAX 100002 int n; vector<long long int> v; int main(){ cin >> n; for (int i = 0; i < 3*n; i++){ int a; scanf("%d", &a); v.push_back(a); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); long long int ans = 0; int cnt = 0; for (int i = 1; i < v.size(); i += 2){ ans += v[i]; cnt++; if (cnt == n)break; } printf("%lld\n", ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - AtCoder Group Contest |
User | Kmcode |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 519 Byte |
Status | AC |
Exec Time | 52 ms |
Memory | 6512 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:17:18: 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 | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 6 ms | 764 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 4 ms | 640 KB |
06.txt | AC | 45 ms | 6512 KB |
07.txt | AC | 32 ms | 6000 KB |
08.txt | AC | 52 ms | 6256 KB |
09.txt | AC | 51 ms | 5104 KB |
10.txt | AC | 51 ms | 5360 KB |