제출 #425598

#제출 시각아이디문제언어결과실행 시간메모리
425598muhammad_hokimiyon비스킷 담기 (IOI20_biscuits)C++14
0 / 100
38 ms344 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, std::vector<long long> a) { long long ans = 1; vector<vector<long long>> d(101, vector<long long>(2, 0ll)); while((int)a.size() < 70)a.push_back(0ll); if(a[0] > 0)d[0][0] = 1,ans++; for(int i = 1; i < 61; i++){ if(a[i] > 0){ for(int j = i - 1; j >= 0; j--){ d[i][0] += d[j][0] + d[j][1]; } d[i][0]++; ans += d[i][0]; } for(int j = i - 1; j >= 0; j--){ long long x = 0; for(int h = j + 1; h < i; h++)x += (1ll << h) * a[h]; if(a[j] > 0)x += (1ll << j) * (a[j] - 1); if(x >= (1ll << i))d[i][1] += d[j][0]; if(a[j] > 0){ x += (1ll << j); } if(x >= (1ll << i))d[i][1] += d[j][1]; } if(a[i] == 0)ans += d[i][1]; } return ans; }
#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...