제출 #1273352

#제출 시각아이디문제언어결과실행 시간메모리
1273352pandaa73선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
> using namespace std; #define lf "\n" #define ff endl #define _ << ' ' << #define all(x) begin(x),end(x) #define rall(x) rbegin(x),rend(x) #define infot(str) do { fprintf(stderr, str); } while(0) #define infos(str) do { fprintf(stderr, str"\n"); } while(0) #define infor(str, ...) do { fprintf(stderr, str, __VA_ARGS__); } while(0) #define infof(str, ...) do { fprintf(stderr, str"\n", __VA_ARGS__); } while(0) #ifndef DEBUG #undef infot #undef infos #undef infor #undef infof #define infot(str) #define infos(str) #define infor(str, ...) #define infof(str, ...) #endif using ll = long long; constexpr int LOG = 20; constexpr int MOD = 1e9+7; constexpr int MAXN = 1e5+7; pair<vector<int>, long long> transaction(long long M); void buy_souvenirs(int N, long long P0) { vector<ll> minP(N); iota(rall(minP), 1); vector<ll> maxP(N); iota(rall(maxP), P0 - (N - 1)); minP[0] = P0; vector<int> cnt(N); auto update_minP = [&](int v, ll x) -> void { infof("update_minP(%d, %lld)", v, x); for(; v > 0; v--) { minP[v] = max(minP[v], x); x = minP[v] + 1; } }; auto update_maxP = [&](int v, ll x) -> void { infof("update_maxP(%d, %lld)", v, x); for(; v < N; ++v) { maxP[v] = min(maxP[v], x); x = maxP[v] - 1; } }; auto buy = [&](int v) -> void { infof("============= buy(%d) =============", v); infot("minP:"); for(auto x: minP) infor(" %2lld", x); infos(""); infot("maxP:"); for(auto x: maxP) infor(" %2lld", x); infos(""); ll q = maxP[v]; auto [V, r] = transaction(q); for(auto x: V) cnt[x]++; if(V.size() == 1) { ll p = q - r; update_minP(v, p); update_maxP(v, p); return; } ll sum = 0; int last = N - 1; for(int i = V.size() - 1; i >= 0; i--) { if(last != V[i]) break; sum += minP[last--]; } if(last > v) update_minP(last, sum + r + 1); sum = 0; for(int i = 1; i < V.size(); ++i) sum += minP[V[i]]; update_maxP(v, q - (sum + r)); }; for(int i = 0; i < N; ++i) { while(cnt[i] < i) buy(i); } }

컴파일 시 표준 에러 (stderr) 메시지

souvenirs.cpp:1:1: error: expected unqualified-id before '>' token
    1 | >
      | ^
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
   35 | pair<vector<int>, long long> transaction(long long M);
      |      ^~~~~~
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:6: error: 'vector' was not declared in this scope
souvenirs.cpp:35:1: error: 'pair' does not name a type
   35 | pair<vector<int>, long long> transaction(long long M);
      | ^~~~
souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:38:5: error: 'vector' was not declared in this scope
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |     ^~~~~~
souvenirs.cpp:38:14: error: expected primary-expression before '>' token
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |              ^
souvenirs.cpp:38:16: error: 'minP' was not declared in this scope
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |                ^~~~
souvenirs.cpp:8:17: error: 'rbegin' was not declared in this scope
    8 | #define rall(x) rbegin(x),rend(x)
      |                 ^~~~~~
souvenirs.cpp:38:30: note: in expansion of macro 'rall'
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |                              ^~~~
souvenirs.cpp:8:27: error: 'rend' was not declared in this scope; did you mean 'friend'?
    8 | #define rall(x) rbegin(x),rend(x)
      |                           ^~~~
souvenirs.cpp:38:30: note: in expansion of macro 'rall'
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |                              ^~~~
souvenirs.cpp:38:25: error: 'iota' was not declared in this scope
   38 |     vector<ll> minP(N); iota(rall(minP), 1);
      |                         ^~~~
souvenirs.cpp:39:14: error: expected primary-expression before '>' token
   39 |     vector<ll> maxP(N); iota(rall(maxP), P0 - (N - 1));
      |              ^
souvenirs.cpp:39:16: error: 'maxP' was not declared in this scope
   39 |     vector<ll> maxP(N); iota(rall(maxP), P0 - (N - 1));
      |                ^~~~
souvenirs.cpp:43:12: error: expected primary-expression before 'int'
   43 |     vector<int> cnt(N);
      |            ^~~
souvenirs.cpp: In lambda function:
souvenirs.cpp:49:23: error: 'max' was not declared in this scope
   49 |             minP[v] = max(minP[v], x);
      |                       ^~~
souvenirs.cpp: In lambda function:
souvenirs.cpp:59:23: error: 'min' was not declared in this scope
   59 |             maxP[v] = min(maxP[v], x);
      |                       ^~~
souvenirs.cpp: In lambda function:
souvenirs.cpp:79:23: error: 'transaction' was not declared in this scope
   79 |         auto [V, r] = transaction(q);
      |                       ^~~~~~~~~~~
souvenirs.cpp:81:24: error: 'cnt' was not declared in this scope; did you mean 'int'?
   81 |         for(auto x: V) cnt[x]++;
      |                        ^~~
      |                        int
souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:110:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
  110 |         while(cnt[i] < i) buy(i);
      |               ^~~
      |               int