제출 #877658

#제출 시각아이디문제언어결과실행 시간메모리
877658abczz비스킷 담기 (IOI20_biscuits)C++14
0 / 100
1 ms348 KiB
#include "biscuits.h" #include <iostream> #include <vector> #define ll long long #define ull __int128 using namespace std; ll dp[60][60][2], f; long long count_tastiness(long long x, std::vector<long long> a) { vector <ull> V; ull z = x, s = 1, y = 1; f = 0; for (auto u : a) V.push_back(u); for (int i=0; i<V.size(); ++i) { s *= 2; y *= 2; for (int j=0; j<i; ++j) { V[i] *= 2; } if (i) V[i] += V[i-1]; } for (int i=0; i<V.size(); ++i) { for (int j=0; j<V.size(); ++j) { dp[i][j][0] = dp[i][j][1] = 0; } } for (int i=0; i<V.size(); ++i) { V[i] /= z; } y /= 2; if ((V.back() & y)) ++dp[V.size()-1][V.size()-1][0]; ++dp[V.size()-1][V.size()-1][1]; for (int i=V.size()-1; i>0; --i) { y /= 2; s /= 2; for (int j=i; j<V.size(); ++j) { //cout << i << " " << j << " " << dp[i][j][0] << endl; //cout << i << " " << j << " " << dp[i][j][1] << endl; if ((V[i-1] & y)) dp[i-1][i-1][0] += dp[i][j][0]; dp[i-1][i-1][1] += dp[i][j][0]; if ((V[j] & (s-1)) <= (V[i-1] & (s-1))) { if ((V[j] & y)) dp[i-1][j][0] += dp[i][j][1]; dp[i-1][j][1] += dp[i][j][1]; } else { if ((V[i-1] & y)) dp[i-1][i-1][0] += dp[i][j][1]; dp[i-1][i-1][1] += dp[i][j][1]; } } } for (int i=0; i<V.size(); ++i) { f += dp[0][i][0] + dp[0][i][1]; } return f; }

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:16:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for (int i=0; i<V.size(); ++i) {
      |                ~^~~~~~~~~
biscuits.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for (int i=0; i<V.size(); ++i) {
      |                ~^~~~~~~~~
biscuits.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for (int j=0; j<V.size(); ++j) {
      |                 ~^~~~~~~~~
biscuits.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for (int i=0; i<V.size(); ++i) {
      |                ~^~~~~~~~~
biscuits.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for (int j=i; j<V.size(); ++j) {
      |                 ~^~~~~~~~~
biscuits.cpp:53:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<__int128>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for (int i=0; i<V.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...