Submission #604018

#TimeUsernameProblemLanguageResultExecution timeMemory
604018PanTkdTeams (IOI15_teams)C++14
34 / 100
4051 ms12496 KiB
// // main.cpp // // Created by Panagiotis Chadjicostas on // Copyright © Panagiotis Hadjicostas. All rights reserved. // #include "teams.h" #include <iostream> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <fstream> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <cstring> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #include <unordered_map> using namespace std; typedef int ll; typedef vector<ll> vi; typedef pair<ll,ll> ii; #define fo(i,a,b) for(int i = a; i<=b; i++) #define f(i,b) for(int i=0;i<b;i++) #define F first #define S second #define sz size #define ls s,m,idx<<1 #define rs m+1,e,idx<<1|1 const ll MOD=ll(1e9)+7; const ll MAXN=2*ll(1e6); void checker(){ ll n=rand()%20+2; vi a(n,ll()); for(ll i=0;i<n;i++){ a[i]=rand()%20+2; } for(ll b=0;b<(1<<n);b++){ vi on,off; for(ll i=0;i<n;i++){ if(i&(1<<i)){ on.push_back(i); } else{ off.push_back(i); } } } } /////////////////////////////////////////////////////////////////////// vector<pair<ll,ll> > V; vector<vi> v; bool cmp(ii a,ii b){ if(a.F<b.F) return 1; else if(b.F<a.F) return 0; else if(a.S<b.S) return 1; else return 0; } void init(int N, int A[], int B[]){ //v.assign(5000001,vi()); for(ll i=0;i<N;i++){ //v[A[i]].push_back(B[i]); ii p; p.F=A[i],p.S=B[i]; V.push_back(p); } sort(V.begin(),V.end()); } int can(int M, int K[]){ sort(K,K+M); ll L=V.size(); ll idx=0; priority_queue<ll, vi, greater<ll> > pq; for(ll i=0;i<M;i++){ while(idx<L && V[idx].F<=K[i]){ pq.push(V[idx].S); idx++; } ll temp=K[i]; while(temp){ if((ll)pq.size()==0)return 0; ll x=pq.top(); pq.pop(); if(x>=K[i])temp--; } } return 1; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll N;cin>>N; ll A[N],B[N]; for(ll i=0;i<N;i++) cin>>A[i]>>B[i]; init(N,A,B); ll Q;cin>>Q; while(Q--){ ll M;cin>>M; ll K[M]; for(ll i=0;i<M;i++) cin>>K[i]; cout<<can(M,K)<<endl; } return 0; } */

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:85:16: warning: conversion from 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} to 'll' {aka 'int'} may change value [-Wconversion]
   85 |     ll L=V.size();
      |          ~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...