Submission #329724

#TimeUsernameProblemLanguageResultExecution timeMemory
329724figter001Teams (IOI15_teams)C++17
0 / 100
4062 ms16468 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define fast ios::sync_with_stdio(false);cin.tie(0); typedef long long ll; typedef long double ld; typedef unsigned long long ull; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<pair<int,int>> s; int n; void init(int N, int A[], int B[]) { n = N; for(int i=0;i<n;i++){ s.push_back({A[i], B[i]}); } sort(all(s) , [](pair<int,int> a,pair<int,int> b){ if(a.second == b.second) return a.first < b.first; return a.second < b.second; }); } int can(int M, int K[]) { sort(K,K+M); int id = 0,cnt=0; for(int i=0;i<s.size();i++){ if(id == M)break; cnt += (s[i].first <= K[id] && s[i].second >= K[id]); if(cnt == K[id]){ cnt = 0; id++; } } return id == M; }

Compilation message (stderr)

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