Submission #1121056

#TimeUsernameProblemLanguageResultExecution timeMemory
1121056SalihSahinTeams (IOI15_teams)C++14
21 / 100
4059 ms15172 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #include "teams.h" vector<pair<int, int> > st; bool comp(pair<int, int> p1, pair<int, int> p2){ if(p1.second == p2.second) return (p1.first < p2.first); else return (p1.second < p2.second); } void init(int N, int A[], int B[]){ for(int i = 0; i < N; i++){ st.pb({A[i], B[i]}); } sort(st.begin(), st.end(), comp); } int can(int M, int K[]) { sort(K, K + M); vector<int> cnt(M); for(int i = 0; i < st.size(); i++){ for(int j = 0; j < M; j++){ if(cnt[j] < K[j] && st[i].first <= K[j] && st[i].second >= K[j]){ cnt[j]++; //cout<<j<<" -> "<<K[j]<<" ye "<<st[i].first<<" "<<st[i].second<<endl; break; } } } bool ok = 1; for(int i = 0; i < M; i++){ if(cnt[i] != K[i]) ok = 0; } return ok; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 0; i < st.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...