Submission #186172

#TimeUsernameProblemLanguageResultExecution timeMemory
186172TAISA_Teams (IOI15_teams)C++14
0 / 100
4097 ms16392 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; using P=pair<int,int>; vector<P> v; int n; void init(int N, int A[], int B[]) { for(int i=0;i<N;i++){ v.emplace_back(A[i],B[i]); } n=N; sort(v.begin(),v.end()); } int can(int M, int K[]) { sort(K,K+M); vector<int> deg(M); int id=0; for(int i=0;i<n;i++){ while(id<M&&deg[id]==K[id]){ id++; } int l=lower_bound(K,K+M,v[i].first)-K; int r=upper_bound(K,K+M,v[i].second)-K; r--; if(l>r){ continue; } if(l>id){ return 0; } if(id<=r){ deg[l]++; } } while(id<M&&deg[id]==K[id]){ id++; } return (id==M); }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:23:38: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
   int l=lower_bound(K,K+M,v[i].first)-K;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
teams.cpp:24:39: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
   int r=upper_bound(K,K+M,v[i].second)-K;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...