제출 #917898

#제출 시각아이디문제언어결과실행 시간메모리
917898vjudge1Happiness (Balkan15_HAPPINESS)C++17
100 / 100
266 ms16212 KiB
#include "happiness.h" #define V coins[i] #include<bits/stdc++.h> using namespace std; #define ll long long multiset<ll> st[40]; #define L(x) (ll)(log2(x)) ll sum[40]; bool check() { ll s = 0; for(int i = 0; i < 40; s+=sum[i++]) if(st[i].size()&&*st[i].begin()-s>1) return 0; return 1; } bool init(int coinsCount, ll maxCoinSize, ll coins[]) { for(int i=0;i<coinsCount;i++) st[L(V)].insert(V),sum[L(V)]+=V; return check(); } bool is_happy(int event, int coinsCount, ll coins[]) { for(int i=0;i<coinsCount;i++) if(event>0) st[L(V)].insert(V), sum[L(V)]+=V; else st[L(V)].erase(st[L(V)].find(V)),sum[L(V)]-=V; return check(); }

컴파일 시 표준 에러 (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...