Submission #1195365
Source Code Expand
#include <iostream>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
int N, a[300000], b[100000][3];
int main(void) {
cin >> N;
REP(i, 0, N * 3) cin >> a[i];
sort(a, a + N * 3);
reverse(a, a + N * 3);
// REP(i, 0, N * 3) cout << a[i] << endl;
REP(i, 0, N) {
b[i][0] = a[i + N * 2];
b[i][1] = a[i + N];
b[i][2] = a[i];
}
// REP(i, 0, N) cout << b[i][0] << ", " << b[i][1] << ", " << b[i][2] << endl;
REP(i, 0, N - 1)
if(b[i][1] < b[i + 1][2] && b[i][1] >= b[i + 1][1])
swap(b[i][1], b[i + 1][2]);
// REP(i, 0, N) cout << b[i][0] << ", " << b[i][1] << ", " << b[i][2] << endl;
long ans = 0;
REP(i, 0, N) ans += min(b[i][1], b[i][2]);
cout << ans << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
A - AtCoder Group Contest |
User |
kshinya |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
808 Byte |
Status |
WA |
Exec Time |
182 ms |
Memory |
2560 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 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 |
1 ms |
256 KB |
00_example_02.txt |
AC |
1 ms |
256 KB |
01.txt |
AC |
1 ms |
256 KB |
02.txt |
WA |
1 ms |
256 KB |
03.txt |
WA |
1 ms |
256 KB |
04.txt |
WA |
1 ms |
256 KB |
05.txt |
WA |
9 ms |
384 KB |
06.txt |
AC |
182 ms |
2560 KB |
07.txt |
AC |
57 ms |
2560 KB |
08.txt |
WA |
127 ms |
2560 KB |
09.txt |
WA |
126 ms |
2560 KB |
10.txt |
WA |
127 ms |
2560 KB |