Submission #130987

#TimeUsernameProblemLanguageResultExecution timeMemory
130987mirbek01Teams (IOI15_teams)C++11
34 / 100
4100 ms32236 KiB
# include "teams.h" //# include "grader.cpp" # include <bits/stdc++.h> using namespace std; vector < pair <int, int> > v; void init(int N, int A[], int B[]) { for(int i = 0; i < N; i ++) v.emplace_back(make_pair(B[i], A[i])); sort(v.begin(), v.end()); } int can(int M, int K[]) { sort(K, K + M); set < pair <int, int> > st; int pt = 0; for(int i = 0; i < M; i ++){ int x = K[i]; while(x > 0 && !st.empty()){ pair <int, int> p = *st.begin(); if(p.first <= K[i] && K[i] <= v[p.second].first){ st.erase(st.begin()); x --; } else { if(v[p.second].first < K[i]){ st.erase(st.begin()); } else { break; } } } while(pt < v.size() && x > 0){ st.insert({v[pt].second, pt}); pt ++; while(x > 0 && !st.empty()){ pair <int, int> p = *st.begin(); if(p.first <= K[i] && K[i] <= v[p.second].first){ st.erase(st.begin()); x --; } else { if(v[p.second].first < K[i]){ st.erase(st.begin()); } else { break; } } } } if(x > 0) return 0; } return 1; }

Compilation message (stderr)

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