Submission #1250022

#TimeUsernameProblemLanguageResultExecution timeMemory
1250022tranvinhhuy2010Souvenirs (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include "souvenirs.h" #include <bits/stdc++.h> using namespace std; #define int long long ll n, cnt[105], p[105]; ll adu_calculate(ll s, int k) { s += k*(k-1)/2; return s/k; } void adu_build(ll money) { auto [a, remain] = transaction(money); int k = a.size(); ll sum = money - remain; for (int i : a) cnt[i]++; if (k==1) { p[a[0]] = sum; if (a[0]<n-1) adu_build(sum-1); } else { ll x = adu_calculate(sum, k); adu_build(x-1); while (a.size()>1) { sum -= a.back(); a.pop_back(); } p[a[0]] = sum; } } void adu_complete() { for (int i=1; i<n; i++) { while (cnt[i]<i) { transaction(p[i]); cnt[i]++; } } } void buy_souvenirs(ll N, ll P0) { n = N; adu_build(P0-1); adu_complete(); }

Compilation message (stderr)

souvenirs.cpp:8:1: error: 'll' does not name a type
    8 | ll n, cnt[105], p[105];
      | ^~
souvenirs.cpp:10:1: error: 'll' does not name a type
   10 | ll adu_calculate(ll s, int k) {
      | ^~
souvenirs.cpp:15:6: error: variable or field 'adu_build' declared void
   15 | void adu_build(ll money) {
      |      ^~~~~~~~~
souvenirs.cpp:15:16: error: 'll' was not declared in this scope
   15 | void adu_build(ll money) {
      |                ^~
souvenirs.cpp: In function 'void adu_complete()':
souvenirs.cpp:41:21: error: 'n' was not declared in this scope
   41 |     for (int i=1; i<n; i++) {
      |                     ^
souvenirs.cpp:42:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   42 |         while (cnt[i]<i) {
      |                ^~~
      |                int
souvenirs.cpp:43:25: error: 'p' was not declared in this scope
   43 |             transaction(p[i]);
      |                         ^
souvenirs.cpp: At global scope:
souvenirs.cpp:49:6: error: variable or field 'buy_souvenirs' declared void
   49 | void buy_souvenirs(ll N, ll P0) {
      |      ^~~~~~~~~~~~~
souvenirs.cpp:49:20: error: 'll' was not declared in this scope
   49 | void buy_souvenirs(ll N, ll P0) {
      |                    ^~
souvenirs.cpp:49:26: error: 'll' was not declared in this scope
   49 | void buy_souvenirs(ll N, ll P0) {
      |                          ^~