제출 #1322254

#제출 시각아이디문제언어결과실행 시간메모리
1322254Trisanu_Das축제 (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
#include "festival.h" #include <bits/stdc++.h> using namespace std; vector<int> max_coupons(int A, vector<int> P, vector<int> T){ ll a = A; vector<ll> p(all(P)), t(all(T)); ll n = p.size(); vector<ll> o(n); iota(all(o), 0); sort(all(o), [&](ll i, ll j) { ll x = p[i], y = p[j], t1 = t[i], t2 = t[j]; return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1; }); vector<int> r; for(ll k = 0; k < n; k++){ ll i = o[k]; if(a - p[i] < 0) break; a -= p[i]; a *= t[i]; r.pb((int)i); } return r; }

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

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:6:5: error: 'll' was not declared in this scope
    6 |     ll a = A;
      |     ^~
festival.cpp:7:14: error: template argument 2 is invalid
    7 |     vector<ll> p(all(P)), t(all(T));
      |              ^
festival.cpp:7:18: error: 'all' was not declared in this scope
    7 |     vector<ll> p(all(P)), t(all(T));
      |                  ^~~
festival.cpp:7:18: note: suggested alternatives:
In file included from /usr/include/c++/13/filesystem:48,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200,
                 from festival.cpp:2:
/usr/include/c++/13/bits/fs_fwd.h:154:7: note:   'std::filesystem::perms::all'
  154 |       all               =  0777,
      |       ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89:
/usr/include/c++/13/ranges:1308:27: note:   'std::ranges::views::all'
 1308 |     inline constexpr _All all;
      |                           ^~~
festival.cpp:8:7: error: expected ';' before 'n'
    8 |     ll n = p.size();
      |       ^~
      |       ;
festival.cpp:9:14: error: template argument 2 is invalid
    9 |     vector<ll> o(n);
      |              ^
festival.cpp:9:18: error: 'n' was not declared in this scope
    9 |     vector<ll> o(n);
      |                  ^
festival.cpp:11:22: error: 'll' is not a type
   11 |     sort(all(o), [&](ll i, ll j) {
      |                      ^~
festival.cpp:11:28: error: 'll' is not a type
   11 |     sort(all(o), [&](ll i, ll j) {
      |                            ^~
festival.cpp: In lambda function:
festival.cpp:13:16: error: 'x' was not declared in this scope
   13 |         return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
      |                ^
festival.cpp:13:20: error: 't1' was not declared in this scope; did you mean 't'?
   13 |         return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
      |                    ^~
      |                    t
festival.cpp:13:25: error: 't2' was not declared in this scope; did you mean 't'?
   13 |         return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
      |                         ^~
      |                         t
festival.cpp:13:30: error: 'y' was not declared in this scope
   13 |         return x * t1 * t2 + y * t2 < y * t1 * t2 + x * t1;
      |                              ^
festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:16:11: error: expected ';' before 'k'
   16 |     for(ll k = 0; k < n; k++){
      |           ^~
      |           ;
festival.cpp:16:19: error: 'k' was not declared in this scope
   16 |     for(ll k = 0; k < n; k++){
      |                   ^
festival.cpp:17:11: error: expected ';' before 'i'
   17 |         ll i = o[k];
      |           ^~
      |           ;
festival.cpp:18:12: error: 'a' was not declared in this scope
   18 |         if(a - p[i] < 0) break;
      |            ^
festival.cpp:18:18: error: 'i' was not declared in this scope
   18 |         if(a - p[i] < 0) break;
      |                  ^
festival.cpp:19:9: error: 'a' was not declared in this scope
   19 |         a -= p[i];
      |         ^
festival.cpp:19:16: error: 'i' was not declared in this scope
   19 |         a -= p[i];
      |                ^
festival.cpp:21:11: error: 'class std::vector<int>' has no member named 'pb'
   21 |         r.pb((int)i);
      |           ^~