제출 #1282046

#제출 시각아이디문제언어결과실행 시간메모리
1282046nataliaa축제 (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
#include "festival.h" #include<bits/stdc++.h> using namespace std; std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) { int n = P.size(); pair<int,int> p1[n], p[n]; for(int i = 0; i <n; i++) { p[i].first = P[i]; p[i].second = i; p1[i].first = i; p1[i].second = T[i]; } sort(p, p+n); vector<int> v; for(int i = 0; i < n ; i++) { int mn = 1e9, ind =0; for(int j = 0; j<n; j++) { if(p[j].first<=A&&p[j].first!=0) { int k = (A-p[j].first)*p1[p[j].second].second; if(k<mn) { mn = k; ind = j; } } } p[j].first = 0; v.push_back(j); } return v; }

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

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:27:19: error: 'j' was not declared in this scope
   27 |                 p[j].first = 0;
      |                   ^