Submission #1252503

#TimeUsernameProblemLanguageResultExecution timeMemory
1252503anfi선물 (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include"souvenirs.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second const long long inf = 1e9; long long n,p[105],cn[105]; long long hitung(int s, int k){ s += k*(k-1)/2+k-1; return s/k; } void fin(long long initial_money) { vector<long long> money_stack; vector<vector<int>> v_stack; vector<long long> sum_stack; vector<int> stage_stack; money_stack.push_back(initial_money); v_stack.emplace_back(); sum_stack.push_back(0); stage_stack.push_back(0); while (!money_stack.empty()) { int d = money_stack.size() - 1; if (stage_stack[d] == 0) { auto [v, remain] = transaction(money_stack[d]); v_stack[d] = v; sum_stack[d] = money_stack[d] - remain; for (int i : v) cn[i]++; if (v[0] < last) { while (!v.empty() && v.back() >= last) { sum_stack[d] -= p[v.back()]; v.pop_back(); } v_stack[d] = v; if (v[0] + 1 != last) { ll new_money = hitung(sum_stack[d], v.size()) - 1; money_stack.push_back(new_money); v_stack.emplace_back(); sum_stack.push_back(0); stage_stack.push_back(0); continue; } } stage_stack[d] = 1; } if (stage_stack[d] == 1) { int idx = v_stack[d][0]; p[idx] = sum_stack[d]; last = idx; money_stack.pop_back(); v_stack.pop_back(); sum_stack.pop_back(); stage_stack.pop_back(); } } } void buy_souvenirs(int N, long long p0){ memset(cn, 0, sizeof(cn)); memset(p, 0, sizeof(p)); p[0] = p0, n = N; fin(p0-1); for(int i = 1; i < N; i++){ while(cn[i] < i){ transaction(p[i]); cn[i]++; } } }

Compilation message (stderr)

souvenirs.cpp: In function 'void fin(long long int)':
souvenirs.cpp:35:24: error: 'last' was not declared in this scope; did you mean 'std::chrono::last'?
   35 |             if (v[0] < last) {
      |                        ^~~~
      |                        std::chrono::last
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:101,
                 from souvenirs.cpp:2:
/usr/include/c++/11/chrono:1276:32: note: 'std::chrono::last' declared here
 1276 |     inline constexpr last_spec last{};
      |                                ^~~~
souvenirs.cpp:44:21: error: 'll' was not declared in this scope
   44 |                     ll new_money = hitung(sum_stack[d], v.size()) - 1;
      |                     ^~
souvenirs.cpp:45:43: error: 'new_money' was not declared in this scope
   45 |                     money_stack.push_back(new_money);
      |                                           ^~~~~~~~~
souvenirs.cpp:59:13: error: 'last' was not declared in this scope; did you mean 'std::chrono::last'?
   59 |             last = idx;
      |             ^~~~
      |             std::chrono::last
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:101,
                 from souvenirs.cpp:2:
/usr/include/c++/11/chrono:1276:32: note: 'std::chrono::last' declared here
 1276 |     inline constexpr last_spec last{};
      |                                ^~~~