Submission #1092111

#TimeUsernameProblemLanguageResultExecution timeMemory
1092111vijaygomathinayagamHappiness (Balkan15_HAPPINESS)C++17
0 / 100
0 ms348 KiB
#include "happiness.h" long long max_two_power_above_sum = 1; long long sum = 0; void add(long long x) { sum += x; } void remove(long long x) { sum -= x; } bool check() { max_two_power_above_sum = 1; while (max_two_power_above_sum < sum) max_two_power_above_sum *= 2; 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 (stderr)

grader.cpp: In function 'int main()':
grader.cpp:16:12: warning: unused variable 'max_code' [-Wunused-variable]
   16 |  long long max_code;
      |            ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...