제출 #60742

#제출 시각아이디문제언어결과실행 시간메모리
60742dukati8Teams (IOI15_teams)C++14
34 / 100
4059 ms18328 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a; i<int(b); i++)
#define all(x) x.begin(),x.end()
vector<int> avalible;
vector<int> lost;
vector<pair<int,int> > people;
int n;
void init(int N, int A[], int B[]) {
	n=N;
	rep(i,0,N) {
		people.push_back(make_pair(A[i],B[i]));
	}
	sort(all(people));
	priority_queue <int> temp;
	int j=0;
	int k=0;
	rep (i,0,N) {
		while(j<n && people[j].first<=i) {
			temp.push(-people[j].second);
			j++;
		}
		while(!temp.empty() && -temp.top()<i) {
			temp.pop();
			k++;
		}
		avalible.push_back(j);
		lost.push_back(k);
	}
}

int can(int M, int K[]) {
	vector <int> v;
	rep(i,0,M) {
		v.push_back(K[i]);
	}
	priority_queue <int> temp;
	sort(all(v));
	int j=0;
	rep (i,0,M) {
		int curr=v[i];
		while(j<n && people[j].first<=curr) {
			temp.push(-people[j].second);
			j++;
		}
		while (!temp.empty() && -temp.top()<curr) {
			temp.pop();
		}
		if (temp.size()<curr) return 0;
		rep (a,0,curr) {
			temp.pop();
		}
	}
	return 1;
}

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:50:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (temp.size()<curr) return 0;
       ~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...