Submission #373844

#TimeUsernameProblemLanguageResultExecution timeMemory
373844eulerdesojaRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; #define ll long long #define pb push_back #define sz(x) int(x.size()) typedef pair<int,int>ii; typedef vector<int> vi; bool solve(int p,int a,int b,int t,int x[],int y[],int w[],int s[]){ int id=0;//onde eu parei nos brinquedu priority_queue<ii,vector<ii>>pq; for(int i=0;i<a;i++){ for(;id<t;id++){ if(w[id]>=x[i])break; pq.push({s[id],w[id]}); } int cnt=0; while(!pq.empty() && cnt<p){ cnt++; pq.pop(); } } for(;id<t;id++)pq.push({s[id],w[id]}); for(int i=b-1;i>=0;i--){ int cnt=0; while(!pq.empty() && pq.top().first<y[i] && cnt<p){ cnt++; pq.pop(); } } return pq.empty(); } int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){ int a=A,b=B,t=T; int x[a],y[b],w[t],s[t]; for(int i=0;i<a;i++)x[i]=X[i]; for(int i=0;i<b;i++)y[i]=Y[i]; for(int i=0;i<t;i++)w[i]=W[i]; for(int i=0;i<t;i++)s[i]=S[i]; sort(x,x+a); sort(y,y+b); vector<ii>aux; for(int i=0;i<t;i++)aux.pb({w[i],s[i]}); sort(aux.begin(),aux.end()); for(int i=0;i<t;i++){ w[i]=aux[i].first; s[i]=aux[i].second; } int l=0,r=t+10; while(l<r){ int m=(l+r)/2; if(solve(m,a,b,t,x,y,w,s))r=m; else l=m+1; } return r==t+10?-1:r; } /*int32_t main(){ ios_base::sync_with_stdio(0);cin.tie(0); //setIO("sort"); int a,b,t; int x[20],y[20],w[20],s[20]; cin>>a>>b>>t; for(int i=0;i<a;i++)cin>>x[i]; for(int i=0;i<b;i++)cin>>y[i]; for(int i=0;i<t;i++)cin>>w[i]; for(int i=0;i<t;i++)cin>>s[i]; cout<<putaway(a,b,t,x,y,w,s); return 0; }*/

Compilation message (stderr)

/tmp/cc2u1zlM.o: In function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status