# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
275084 | 2020-08-20T04:20:27 Z | 반딧불(#5115) | Happiness (Balkan15_HAPPINESS) | C++17 | 2000 ms | 7528 KB |
#include <bits/stdc++.h> #include "happiness.h" using namespace std; typedef long long ll; int n; multiset<ll> st; bool isAble(){ vector<ll> v (st.begin(), st.end()); ll sum = 0; for(int i=0; i<n; i++){ if(v[i] > sum+1) return false; sum += v[i]; } return true; } bool init(int coinsCount, ll maxCoinSize, ll coins[]) { n = coinsCount; for(int i=0; i<n; i++) st.insert(coins[i]); return isAble(); } bool is_happy(int event, int coinsCount, ll coins[]) { n += coinsCount * event; if(event == -1) for(int i=0; i<coinsCount; i++) st.erase(st.find(coins[i])); else for(int i=0; i<coinsCount; i++) st.insert(coins[i]); return isAble(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 296 ms | 1188 KB | Output is correct |
9 | Correct | 300 ms | 1272 KB | Output is correct |
10 | Correct | 319 ms | 1160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Execution timed out | 2064 ms | 7528 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 296 ms | 1188 KB | Output is correct |
9 | Correct | 300 ms | 1272 KB | Output is correct |
10 | Correct | 319 ms | 1160 KB | Output is correct |
11 | Execution timed out | 2064 ms | 7528 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |