제출 #377284

#제출 시각아이디문제언어결과실행 시간메모리
377284gustason로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); vector<pair<int, int>> a(T); for(int i = 0; i < n; i++) { a[i] = {W[i], S[i]}; } sort(a.begin(), a.end()); int l = 0, r = INF, ans = 0; while(l <= r) { int mid = (l + r) / 2; priority_queue<int> q; int idx = 0; for(int i = 0; i < A; i++) { while(idx < T && X[i] > a[idx].first) { q.push(v[idx].second); idx++; } for(int j = 0; j < mid && !q.empty(); j++) { q.pop(); } } while(idx < T) { q.push(a[idx].second); idx++; } for(int i = B-1; i >= 0; i--) { for(int j = 0; j < mid && !q.empty(); j++) { if (q.top() < Y[i]) { q.pop(); } else { break; } } } if (q.empty()) { ans = mid; r = mid - 1; } else { l = mid + 1; } } if (ans == INF) return -1; return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:10:24: error: 'n' was not declared in this scope
   10 |     for(int i = 0; i < n; i++) {
      |                        ^
robots.cpp:23:24: error: 'v' was not declared in this scope
   23 |                 q.push(v[idx].second);
      |                        ^