제출 #843746

#제출 시각아이디문제언어결과실행 시간메모리
843746PagodePaivaA Plus B (IOI23_aplusb)C++17
컴파일 에러
0 ms0 KiB
#include "aplusb.h" #include<bits/stdc++.h> using namespace std; std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) { priority_queue <tuple <int, int, int>> pq; pq.push({-A[0]-B[0], 0, 0}); map <pair <int, int>, int> mark; mark[{0, 0}] = 1; vector <int> ans; for(int i = 0;i < N;i++){ auto [v, l, r] = pq.top(); pq.pop(); v *= -1; ans.push_back(v); if(!(mark[{l, r+1}] == 1 or (l >= n or r >= n))) pq.push({-A[l]-B[r+1], l, r+1}); if(!(mark[{l+1, r}] == 1 or (l >= n or r >= n)))pq.push({-A[l+1]-B[r], l+1, r}); } return ans; }

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

aplusb.cpp: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:20:37: error: 'n' was not declared in this scope
   20 |   if(!(mark[{l, r+1}] == 1 or (l >= n or r >= n))) pq.push({-A[l]-B[r+1], l, r+1});
      |                                     ^
aplusb.cpp:21:37: error: 'n' was not declared in this scope
   21 |   if(!(mark[{l+1, r}] == 1 or (l >= n or r >= n)))pq.push({-A[l+1]-B[r], l+1, r});
      |                                     ^