Submission #896140

# Submission time Handle Problem Language Result Execution time Memory
896140 2023-12-31T22:09:19 Z vjudge1 Happiness (Balkan15_HAPPINESS) C++17
30 / 100
2000 ms 6736 KB
#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

grader.cpp: In function 'int main()':
grader.cpp:16:12: warning: unused variable 'max_code' [-Wunused-variable]
   16 |  long long max_code;
      |            ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 78 ms 964 KB Output is correct
9 Correct 88 ms 1168 KB Output is correct
10 Correct 94 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Execution timed out 2090 ms 6736 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 78 ms 964 KB Output is correct
9 Correct 88 ms 1168 KB Output is correct
10 Correct 94 ms 1112 KB Output is correct
11 Execution timed out 2090 ms 6736 KB Time limit exceeded
12 Halted 0 ms 0 KB -