Submission #1368879


Source Code Expand

#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what

using namespace std;
 
const int N = (int) 2e5 + 10;
const int M = (int) 18;
const ll big =  (1LL << 51);
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const double EPS = (double) 1e-6;
const double PI =  3.14159265359;
int n;

int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    srand(time(0));
    cin >> n;
    multiset<int> st;
    for (int i = 1, a; i <= 3 * n; i++) {
        cin >> a;
        st.insert(a);
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        st.erase(st.begin());
        st.erase(--st.end());
        ans += *st.rbegin();
        st.erase(--st.end());
    } 
    cout << ans;
    return 0;
}   

Submission Info

Submission Time
Task A - AtCoder Group Contest
User Nurlykhan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1143 Byte
Status AC
Exec Time 222 ms
Memory 14336 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 1 ms 256 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 11 ms 1152 KB
06.txt AC 222 ms 14336 KB
07.txt AC 137 ms 14336 KB
08.txt AC 207 ms 14336 KB
09.txt AC 205 ms 14336 KB
10.txt AC 204 ms 14336 KB