Submission #132320

#TimeUsernameProblemLanguageResultExecution timeMemory
132320redaTeams (IOI15_teams)C++14
13 / 100
4091 ms31852 KiB
#include<bits/stdc++.h> using namespace std ; # include "teams.h" vector<pair<int,int>> v; void init( int n , int a[] , int b[]) { for(int i= 0; i < n ; i ++) { v.push_back(make_pair(b[i],a[i])); } sort(v.begin(),v.end()); } int can(int M, int K[]) { set < pair <int, int> > s; int p = 0; sort(K, K + M); for(int i = 0; i < M; i ++) { int flag = K[i]; while(p < v.size() && flag > 0) { s.insert({v[p].second, p}); p++; while( flag> 0 && !s.empty()) { pair <int, int> it = *s.begin(); if(it.first <= K[i] && K[i] <= v[it.second].first) { s.erase(s.begin()); flag--; } else if(v[it.second].first < K[i])s.erase(s.begin()); else break; } } if(flag > 0) return 0; } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             while(p < v.size() && flag > 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...