제출 #405785

#제출 시각아이디문제언어결과실행 시간메모리
405785ly20비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1095 ms332 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 40, INF = 1e9; int mc[MAXN]; long long count_tastiness(long long x, vector<long long> a) { long long resp = 0; for(int j = 0; j <= 100000; j++) { for(int i = 0; i < a.size(); i++) { mc[i] = a[i]; } bool ok = true; for(int i = MAXN - 1; i >= 0; i--) { long long rq = x; if((1LL << i) & j == 0) continue; for(int k = i; k >= 0; k--) { if(rq > INF) break; if(mc[i] <= rq) { rq -= mc[i]; mc[i] = 0; } if(mc[i] > rq) { rq = 0; mc[i] -= rq; } rq *= 2; } if(rq != 0) ok = false; } if(ok) resp++; } return resp; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for(int i = 0; i < a.size(); i++) {
      |                        ~~^~~~~~~~~~
biscuits.cpp:18:31: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   18 |             if((1LL << i) & j == 0) continue;
      |                             ~~^~~~
#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...