제출 #123746

#제출 시각아이디문제언어결과실행 시간메모리
123746turbat로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
 
int a, b, t, *x, *y, *w, *s, cnt;
priority_queue <int> se;
pair <int, int> p[1000005];
vector <int> vc;
bool can(int k){
	se.clear();
	int j = 0;
	for (int i = 0;i < a;i++){
		while (j < t && p[j].first < x[i])
			se.push(s[p[j++].second]);
		cnt = k;
		while (cnt-- && !se.empty()) se.pop();
	}
	for (;j < t;j++) se.push(s[p[j].second]);
	vc.clear();
	while (!se.empty()){
		vc.push_back(se.top());
		se.pop();
	}
	reverse(vc.begin(), vc.end());
	j = 0;
	cnt = k;
	for (auto it : vc){
		while (j < b && (!cnt || it >= y[j])){
			j++;
			cnt = k;
		}
		if (j == b) return 0;
		cnt--;
	}
	return 1;
}
 
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
	a = A, b = B, t = T, x = X, y = Y, w = W, s = S;
	sort(x, x + a);
	sort(y, y + b);
	for (int i = 0;i < t;i++){
		if (w[i] >= x[a - 1] && s[i] >= y[b - 1]) 
			return -1;
		p[i].first = w[i];
		p[i].second = i;
	}
	sort(p, p + t);
	int l = 1, r = t, mid;
	while (l != r){
		mid = (l + r) / 2;
		if (can(mid)) r = mid;
		else l = mid + 1;
	}
    return l;
}

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

robots.cpp: In function 'bool can(int)':
robots.cpp:10:5: error: 'class std::priority_queue<int>' has no member named 'clear'
  se.clear();
     ^~~~~