Submission #1368877


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 a[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; i <= 3 * n; i++) {
        cin >> a[i];
        st.insert(a[i]);
    }
    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 0
Code Size 1157 Byte
Status RE
Exec Time 2104 ms
Memory 10368 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 7
WA × 3
TLE × 1
RE × 1
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 TLE 2104 ms 10368 KB
07.txt WA 77 ms 10368 KB
08.txt RE 219 ms 10368 KB
09.txt WA 131 ms 10368 KB
10.txt WA 131 ms 10368 KB