Submission #1194609


Source Code Expand

#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

typedef pair<int, int> pii;
typedef long long LL;
typedef vector<int> VI;

inline int read(){
	int x = 0, ch = getchar(), f = 1;
	while (!isdigit(ch)){if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}

int n;
int a[300005];
int main(){
	n = read();
	REP(i, 1, 3 * n) a[i] = read();
	sort(a + 1, a + 3 * n + 1);
	LL ans = 0;
	for (int i = 3 * n, j = 1; i >= j; i -= 2, ++j){
		// cerr << a[i - 1] << endl;
		ans += a[i - 1];
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task A - AtCoder Group Contest
User zkx06111
Language C++14 (GCC 5.4.1)
Score 300
Code Size 888 Byte
Status AC
Exec Time 35 ms
Memory 1408 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
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 2 ms 384 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 3 ms 256 KB
06.txt AC 30 ms 1408 KB
07.txt AC 10 ms 1408 KB
08.txt AC 35 ms 1408 KB
09.txt AC 35 ms 1408 KB
10.txt AC 35 ms 1408 KB