# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092102 | 2024-09-23T07:56:37 Z | vijaygomathinayagam | Happiness (Balkan15_HAPPINESS) | C++17 | 2000 ms | 344 KB |
#include "happiness.h" long long max_two_power_above_sum = 1; long long sum = 0; void add(long long x) { sum += x; while (max_two_power_above_sum < sum) max_two_power_above_sum *= 2; } void remove(long long x) { sum -= x; while ((max_two_power_above_sum / 2) > sum) max_two_power_above_sum /= 2; } bool check() { return max_two_power_above_sum - 1 == sum; } bool init(int coinsCount, long long maxCoinSize, long long coins[]) { for (int i = 0; i < coinsCount; i++) add(coins[i]); return check(); } bool is_happy(int event, int coinsCount, long long coins[]) { for (int i = 0; i < coinsCount; i++) remove(coins[i]); return check(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2050 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2050 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2050 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2050 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |