Submission #1207136

#TimeUsernameProblemLanguageResultExecution timeMemory
1207136tkm_algorithmsPacking Biscuits (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
/** * In the name of Allah * We are nothing and you're everything **/ #include <bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() //#define int long long const char nl = '\n'; const int max_sum = 1e5; ll count_tastiness(ll x, vector<ll> a) { int k = sz(a); vector<ll> onki = a; if (x > max_sum)return 1; auto check = [&](int y) { int rep = x; while (rep--) { int want = y; for (int t = k-1; t >= 0; --t) { int d = min(want/(1ll<<t), a[t]); a[t] -= d; want -= (1ll<<t)*d; } if (want > 0)return 0; } return 1; }; int res = 0; for (int i = 0; i*x <= max_sum; ++i) { res += check(i); a = onki; } return res; } //int32_t main() { //ios::sync_with_stdio(0); //cin.tie(0); //cout << count_tastiness(2, {2, 1, 2}); //return 0; //} /** * In the name of Allah * We are nothing and you're everything **/ #include <bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() //#define int long long const char nl = '\n'; const int max_sum = 1e5; ll count_tastiness(ll x, vector<ll> a) { int k = sz(a); vector<ll> onki = a; if (x > max_sum)return 1; auto check = [&](int y) { int rep = x; while (rep--) { int want = y; for (int t = k-1; t >= 0; --t) { int d = min(want/(1ll<<t), a[t]); a[t] -= d; want -= (1ll<<t)*d; } if (want > 0)return 0; } return 1; }; int res = 0; for (int i = 0; i*x <= max_sum; ++i) { res += check(i); a = onki; } return res; } //int32_t main() { //ios::sync_with_stdio(0); //cin.tie(0); //cout << count_tastiness(2, {2, 1, 2}); //return 0; //}

Compilation message (stderr)

biscuits.cpp:62:12: error: redefinition of 'const char nl'
   62 | const char nl = '\n';
      |            ^~
biscuits.cpp:14:12: note: 'const char nl' previously defined here
   14 | const char nl = '\n';
      |            ^~
biscuits.cpp:63:11: error: redefinition of 'const int max_sum'
   63 | const int max_sum = 1e5;
      |           ^~~~~~~
biscuits.cpp:15:11: note: 'const int max_sum' previously defined here
   15 | const int max_sum = 1e5;
      |           ^~~~~~~
biscuits.cpp:65:4: error: redefinition of 'll count_tastiness(ll, std::vector<long long int>)'
   65 | ll count_tastiness(ll x, vector<ll> a) {
      |    ^~~~~~~~~~~~~~~
biscuits.cpp:17:4: note: 'long long int count_tastiness(long long int, std::vector<long long int>)' previously defined here
   17 | ll count_tastiness(ll x, vector<ll> a) {
      |    ^~~~~~~~~~~~~~~