제출 #1322246

#제출 시각아이디문제언어결과실행 시간메모리
1322246Trisanu_DasFestival (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){ int n; cin >> n; vector<int> op(n); iota(op.begin(), op.end(), 0); sort(op.begin(), op.end() [&](int i, int j){ return T[i] * T[j] * (P[j] - P[i]) > P[j] * T[j] - P[i] * T[i]; }); vector<int> R; for(int k = 0; k < n; k++){ int i = op[k]; if(A > P[i]){ R.push_back(i); A = T[i] * (A - P[i]); }else break; } return R; }

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

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:9:33: error: expected primary-expression before ']' token
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                 ^
festival.cpp:9:35: error: expected primary-expression before 'int'
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                   ^~~
festival.cpp:9:42: error: expected primary-expression before 'int'
    9 |     sort(op.begin(), op.end() [&](int i, int j){
      |                                          ^~~