제출 #742244

#제출 시각아이디문제언어결과실행 시간메모리
742244arthur_nascimento비스킷 담기 (IOI20_biscuits)C++14
0 / 100
1 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define ll long long #define debug ll ans[100]; ll sum[100]; long long count_tastiness(long long x, std::vector<long long> a) { int k = a.size(); ll tot = 1; for(int i=0;i<k;i++){ debug("i %d\n",i); ll lo = -1, hi = tot-1; while(lo < hi){ ll mid = (lo+hi+1)/2; ll num = 0, aux = mid; for(int j=i-1;j>=0;j--) if(aux >= sum[j] - ans[j]){ num |= (1ll << j); aux -= (sum[j] - ans[j]); } ll val = 0; for(int j=0;j<i;j++){ val += a[j]; if(num & (1ll << j)) val -= x; val /= 2; } val += a[i]; debug("mid %lld -> %lld, num %lld\n",mid,val,num); if(val >= x) lo = mid; else hi = mid-1; } debug("add %d\n",lo+1); ans[i] = lo+1; tot += ans[i]; sum[i] = tot; } return tot; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:17:9: warning: left operand of comma operator has no effect [-Wunused-value]
   17 |   debug("i %d\n",i);
      |         ^~~~~~~~
biscuits.cpp:46:10: warning: left operand of comma operator has no effect [-Wunused-value]
   46 |    debug("mid %lld -> %lld, num %lld\n",mid,val,num);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
biscuits.cpp:46:45: warning: right operand of comma operator has no effect [-Wunused-value]
   46 |    debug("mid %lld -> %lld, num %lld\n",mid,val,num);
      |                                             ^~~
biscuits.cpp:46:49: warning: right operand of comma operator has no effect [-Wunused-value]
   46 |    debug("mid %lld -> %lld, num %lld\n",mid,val,num);
      |                                                 ^~~
biscuits.cpp:56:9: warning: left operand of comma operator has no effect [-Wunused-value]
   56 |   debug("add %d\n",lo+1);
      |         ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...