제출 #434522

#제출 시각아이디문제언어결과실행 시간메모리
434522arayiPacking Biscuits (IOI20_biscuits)C++17
0 / 100
46 ms21404 KiB
#include "biscuits.h" #include <vector> #include <iostream> #include <algorithm> using namespace std; #define ad push_back #define lli long long lli dp[120][20010]; long long count_tastiness(long long x, std::vector<long long> a) { for (int i = 0; i < 60; i++) a.ad(0); for (int i = 0; i < a.size(); i++) for (int j = 0; j <= 2*x; j++) dp[i][j]=0; for (int i = 0; i < a.size() - 1; i++) { a[i+1] += max(0LL, (a[i]-x)/2LL); a[i] = min(a[i], x); } //for(auto p : a) cout << p << " "; cout << endl; dp[0][a[0]]=1; if(a[0]==x) dp[0][0]=1; for (int i = 1; i < a.size(); i++) { for (int j = 0; j <= 2*x; j++) { if(dp[i-1][j]==0) continue; int sm = j/2; dp[i][sm+a[i]] += dp[i-1][j]; if(sm + a[i] >= x) dp[i][sm+a[i]-x] += dp[i-1][j]; } } lli ret = 0; for (int i = 0; i <= 2*x; i++) ret += dp[a.size()-1][i]; return ret; }

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

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