Submission #72854

#TimeUsernameProblemLanguageResultExecution timeMemory
72854square1001Teams (IOI15_teams)C++14
34 / 100
4048 ms74800 KiB
#include "teams.h"
#include <queue>
#include <vector>
#include <functional>
using namespace std;

vector<vector<int> > G;
void init(int N, int A[], int B[]) {
	G.resize(N + 1);
	for(int i = 0; i < N; ++i) {
		G[A[i]].push_back(B[i]);
	}
}

int can(int M, int K[]) {
	vector<int> c(G.size());
	for(int i = 0; i < M; ++i) ++c[K[i]];
	priority_queue<int, vector<int>, greater<int> > que;
	for(int i = 0; i < G.size(); ++i) {
		for(int j : G[i]) que.push(j);
		for(int j = 0; j < c[i]; ++j) {
			for(int k = 0; k < i; ++k) {
				bool f = false;
				while(!que.empty()) {
					int u = que.top(); que.pop();
					if(u >= i) {
						f = true; 
						break;
					}
				}
				if(!f) return 0;
			}
		}
	}
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:19:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < G.size(); ++i) {
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...