# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896145 | boyliguanhan | Happiness (Balkan15_HAPPINESS) | C++17 | 2070 ms | 5724 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "happiness.h"
#include<bits/stdc++.h>
using namespace std;
multiset<long long> st;
bool init(int coinsCount, long long maxCoinSize, long long coins[]) {
for(int i = 0; i < coinsCount; i++)
st.insert(coins[i]);
long long sum=0;
for(auto i: st)
if(sum+1<i)
return 0;
else sum+=i;
return 1;
}
bool is_happy(int event, int coinsCount, long long coins[]) {
for(int i = 0; i < coinsCount; i++)
if(event<0)
st.erase(st.find(coins[i]));
else st.insert(coins[i]);
long long sum=0;
for(auto i: st)
if(sum+1<i)
return 0;
else sum+=i;
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |