Submission #585850

#TimeUsernameProblemLanguageResultExecution timeMemory
585850Dan4LifeRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pii pair<int,int> #define fi first #define se second #define all(a) a.begin(), a.end() #define sz(a) (int)a.size() const int INF = (int)1e9; vector<pii> weak, small, toy; bool work(int i, int j, int type){ if(type==0) return weak[i].fi>toy[j].fi; return small[i].se>toy[j].se; } bool chk(int x){ reverse(all(toy)); int j = sz(weak)-1, cnt = 0; bool ok = true; for(int i = 0; i < sz(toy); i++){ ok&=(work(j,i,0)); if(cnt==x) j--, cnt=0; cnt++; } reverse(all(toy)); return ok; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i = 0; i < A; i++) weak.pb({X[i],INF}); for(int i = 0; i < B; i++) small.pb({INF,Y[i]}); for(int i = 0; i < T; i++) toy.pb({W[i],S[i]}); sort(all(weak)), sort(all(small)), sort(all(toy)); if(A==0){ if(work(0,0,1) and work(1,1,1)) return 1; if(work(1,0,1) and work(1,1,1)) return 2; return -1; } else if(B==0){ if(!work(A-1,T-1,0)) return -1; int l = (T+A-1)/A, r = T; while(l<r){ int mid = (l+r+1)/2; if(chk(mid)) r=mid; else l=mid+1; } return l; } else{ if(work(0,0,0) and work(0,1,1)) return 1; if(work(0,0,1) and work(0,1,0)) return 1; if(work(0,0,0) and work(0,1,0)) return 2; if(work(0,0,1) and work(0,1,1)) return 2; return -1; } }

Compilation message (stderr)

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