Submission #1050765

#TimeUsernameProblemLanguageResultExecution timeMemory
1050765nightfalPacking Biscuits (IOI20_biscuits)C++17
Compilation error
0 ms0 KiB
#include <cassert> #include <iostream> #include <cstdio> #include <vector> using namespace std; #define ll long long template <typename T> void print(T elem) {cout << elem << " ";} template <typename T> void print(vector<T> &v) {for(auto elem: v) print(elem); cout << endl;} void arrange(ll x, vector<ll> &a) { int k=a.size(); for(int i=0; i<k-1; i++) if (a[i] > x+1) { ll excess = (a[i]-x)/2; a[i] -= 2*excess; a[i+1] += excess; } return; } int possible(ll n, ll x, vector<ll> a) { int k = a.size(); // cout << "n:" << n << endl; ll m = n; for(int i=0; i<k && m>0; i++) { bool one = m%2; m >>= 1; if (a[i] > x+1) { ll excess = (a[i]-x)/2; a[i] -= 2*excess; a[i+1] += excess; } if (one) {if (a[i]<x) return 0;} else if (i<k-1) {a[i+1] += a[i]/2; a[i]=0;} // cout << "i:" << i << ", a: "; print(a); } if (m>0) return 0; else return 1; } ll subtask2(vector<ll> a) { int k=a.size(); ll prev = 0, curr = 1; for(int i=0; i<k; i++) { switch(a[i]) { case 0: curr += prev; prev = 0; break; case 1: curr *= 2; break; case 2: curr += prev; curr *=2; prev = curr; } } return curr; } ll subtask1(ll x, vector<ll> a) { ll cnt = 0; for(int i=0; i<=100'000; i++) { cnt += possible(i,x,a); } return cnt; } return cnt; ll count_tastiness(ll x, std::vector<ll> a) { a.resize(60,0); arrange(x,a); // if (x==1) return subtask2(a); return subtask1(ll x, a); }

Compilation message (stderr)

biscuits.cpp:61:2: error: expected unqualified-id before 'return'
   61 |  return cnt;
      |  ^~~~~~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:6:12: error: expected primary-expression before 'long'
    6 | #define ll long long
      |            ^~~~
biscuits.cpp:66:21: note: in expansion of macro 'll'
   66 |     return subtask1(ll x, a);
      |                     ^~