(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #303919

#제출 시각아이디문제언어결과실행 시간메모리
303919Pajaraja비스킷 담기 (IOI20_biscuits)C++17
100 / 100
14 ms896 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define MAXN 67 using namespace std; long long dp[MAXN],dpu[MAXN],p[MAXN]; long long count_tastiness(long long x, std::vector<long long> a) { int k=0; while((x<<k)<=3000000000000000000LL) { k++; if(k-1==a.size()) a.push_back(0); } p[0]=a[0]; for(long long i=1;i<k;i++) p[i]=p[i-1]+(a[i]<<i); for(long long i=0;i<k;i++) { long long mx=(p[i]-(x<<i))/x; dpu[i]=0; if(p[i]>=(x<<i)) { if(mx>=(1LL<<i)) dpu[i]=(i!=0)?dp[i-1]:1; else { bool fas=false; for(long long j=i-1;j>=0;j--) if((1LL<<j)&mx) { dpu[i]+=(j!=0)?dp[j-1]:1; long long nx=(p[j]-(x<<j))/x; if(p[j]<(x<<j)) {fas=true; break;} mx^=(1LL<<j); if(nx<mx) {dpu[i]+=dpu[j]; fas=true; break;} } if(!fas) dpu[i]++; } } dp[i]=(i!=0)?dp[i-1]:1; dp[i]+=dpu[i]; } return dp[k-1]; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         if(k-1==a.size()) a.push_back(0);
      |            ~~~^~~~~~~~~~
#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...