Submission #204221

#TimeUsernameProblemLanguageResultExecution timeMemory
204221SegtreeTeams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include<algorithm> #include<vector> #include<queue> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod #define NS 110 vector<P> v; int dat[NS]; void init(int N,int A[],int B[]){ rep(i,N)v.push_back(make_pair(B[i],A[i])); sort(v.begin(),v.end()); rep(i,NS)dat[i]=0; } void add(int K){ rep(i,v.size()){ if(v[i].second<=K&&dat[i]==0)dat[i]=1; } } void erase(int n){ for(int i=0;i<=n;i++){ if(dat[i]==1)dat[i]=2; } } int sum(int n){ ll res=0; for(int i=0;i<=n;i++){ res+=(dat[i]==1); } return res; } int can(int M,int K[]){ rep(i,NS)dat[i]=0; sort(K,K+M); rep(i,M){ add(K[i]); ll l,r,mid; l=-1,r=v.size(); while(l<r-1){ mid=(l+r)>>1; (v[mid].first<K[i]?l:r)=mid; } erase(l); //rep(j,v.size())if(v[j].first<K[i]&&dat[j]==1)dat[j]=2; /*l=-1,r=v.size(); while(l<r-1){ mid=(l+r)>>1; (sum(mid)>=K[i]?r:l)=mid; } if(r==v.size())return 0; erase(r);*/ int cnt=K[i]; rep(j,v.size())if(dat[j]==1){ cnt--; dat[j]=2; if(cnt==0)break; } if(cnt>0)return 0; } return 1; } int main(){ int n,a[110],b[110]; cin>>n; rep(i,n)cin>>a[i]>>b[i]; init(n,a,b); while(1){ int m,k[110]; cin>>m; rep(i,m)cin>>k[i]; cout<<(can(m,k)?"YES":"NO")<<endl; } }

Compilation message (stderr)

teams.cpp: In function 'void add(int)':
teams.cpp:10:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n) for(int i=0;i<n;i++)
teams.cpp:24:6:
  rep(i,v.size()){
      ~~~~~~~~~~                
teams.cpp:24:2: note: in expansion of macro 'rep'
  rep(i,v.size()){
  ^~~
teams.cpp: In function 'int sum(int)':
teams.cpp:38:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return res;
         ^~~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:52:10: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   erase(l);
          ^
teams.cpp:10:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n) for(int i=0;i<n;i++)
teams.cpp:62:7:
   rep(j,v.size())if(dat[j]==1){
       ~~~~~~~~~~               
teams.cpp:62:3: note: in expansion of macro 'rep'
   rep(j,v.size())if(dat[j]==1){
   ^~~
/tmp/ccXQRfrY.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccPFkTAm.o:teams.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status