Submission #610551

#TimeUsernameProblemLanguageResultExecution timeMemory
610551nekiRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define vc vector

using namespace std;

int putaway(int A,int B,int T, vc<int> X,vc<int> Y,vc<int> W,vc<int> S){
    int l=1, r=T+1;
    
    vc<int> ind(T);for(int i=0;i<T;++i) ind[i]=i;
    sort(ind.begin(), ind.end(), [&](int a, int b){return W[a]<W[b];});
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    
    function<bool (int)> check=[&](int k){
        map<int, int> prosti;
        for(int y: Y) prosti[y]+=k;
        
        int j=A-1;
        for(int i=T-1;i>=0;--i){
            while(j>=0 and X[j]>W[ind[i]]) prosti[INT_MAX]+=k, --j;
            
            auto poi=prosti.upper_bound(S[ind[i]]);
            if(poi==prosti.end()) return false;
            
            if(--poi->second ==0) prosti.erase(poi);
        }
        return true;
    };
    if(check(T)){
        while(l<r){
            int mid=(l+r)/2;
            if(check(mid)) r=mid;
            else l=mid+1;
        }
        return l;
    }
    else return -1;
}

Compilation message (stderr)

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