제출 #1252335

#제출 시각아이디문제언어결과실행 시간메모리
1252335NekoRolly축제 (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
#include "festival.h" #include<bits/stdc++.h> using namespace std; struct coupon{ ll p,t,id; }; bool comp(coupon A,coupon B){ // *{P[i], T[i]} auto [p, a, ida] = A; auto [q, b, idb] = B; return a*b*p + b*q <= a*b*q + a*p; } vector<int> max_coupons(int A,vector<int> P,vector<int> T){ int n = P.size(); coupon a[n]; for (int i=0; i<P.size(); i++) a[i] = {P[i], T[i], i}; sort(a, a+n, comp); vector<int> vans; for (int i=0; i<n; i++) vans.push_back(a[i].id); return vans; }

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

festival.cpp:6:5: error: 'll' does not name a type
    6 |     ll p,t,id;
      |     ^~
festival.cpp: In function 'bool comp(coupon, coupon)':
festival.cpp:10:10: error: cannot decompose class type 'coupon' without non-static data members
   10 |     auto [p, a, ida] = A;
      |          ^~~~~~~~~~~
festival.cpp:11:10: error: cannot decompose class type 'coupon' without non-static data members
   11 |     auto [q, b, idb] = B;
      |          ^~~~~~~~~~~
festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:20:30: error: no match for 'operator=' (operand types are 'coupon' and '<brace-enclosed initializer list>')
   20 |         a[i] = {P[i], T[i], i};
      |                              ^
festival.cpp:5:8: note: candidate: 'constexpr coupon& coupon::operator=(const coupon&)'
    5 | struct coupon{
      |        ^~~~~~
festival.cpp:5:8: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const coupon&'
festival.cpp:5:8: note: candidate: 'constexpr coupon& coupon::operator=(coupon&&)'
festival.cpp:5:8: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'coupon&&'
festival.cpp:26:29: error: 'struct coupon' has no member named 'id'
   26 |         vans.push_back(a[i].id);
      |                             ^~