제출 #805393

#제출 시각아이디문제언어결과실행 시간메모리
805393WLZ비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1083 ms63144 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "../../templates/debug.h"
#else
#define debug(...) 0
#endif

long long count_tastiness(long long x, std::vector<long long> a) {
  for (int i = 0; i < (int) a.size(); i++) {
    if (a[i] > x) {
      if (i == (int) a.size() - 1) a.push_back(0);
      a[i + 1] += (a[i] - x) / 2;
      a[i] -= (a[i] - x) / 2;
    }
  }
  while ((int) a.size() < 240) a.push_back(0);
  //int k = (int) a.size();
  long long ans = 0;
  vector< map<long long, long long> > dp(240, map<long long, long long>());
  dp[0][0] = 1;
  for (int i = 0; i < 240; i++) {
    for (auto &[j, d] : dp[i]) {
      if (j >= 0) ans += d;
      long long extra = j;
      for (int t = i + 1; t < 240; t++) {
        extra = (extra / 2) - (extra < 0);
        extra += a[t - 1];
        dp[t][extra - x] += d;
      }
    }
  }
  debug(dp);
  return ans;
}

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:8:20: warning: statement has no effect [-Wunused-value]
    8 | #define debug(...) 0
      |                    ^
biscuits.cpp:35:3: note: in expansion of macro 'debug'
   35 |   debug(dp);
      |   ^~~~~
#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...