Submission #1098916

#TimeUsernameProblemLanguageResultExecution timeMemory
1098916alexander_707070Teams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "teams.h" #define MAXN 200007 using namespace std; struct interval{ int l,r; inline friend bool operator < (interval fr,interval sc){ return fr.r>sc.r; } }s[MAXN]; bool cmp(interval fr,interval sc){ return fr.l<sc.l; } priority_queue<interval> q; int n,m,a[MAXN],b[MAXN],k[MAXN]; void init(int N, int A[], int B[]) { //void init(int N, vector<int> A, vector<int> B) { n=N; for(int i=1;i<=n;i++){ a[i]=A[i-1]; b[i]=B[i-1]; } } int can(int M,vector<int> K) { //int can(int M,vector<int> K) { m=M; for(int i=1;i<=m;i++){ k[i]=K[i-1]; } sort(k+1,k+m+1); int l=1,r=0; for(int i=1;i<=n;i++){ while(r+1<n and k[r+1]<=b[i])r++; while(l<=n and k[l]<a[i])l++; s[i].l=l; s[i].r=r; } sort(s+1,s+n+1,cmp); while(!q.empty())q.pop(); int pt=1; for(int i=1;i<=m;i++){ while(pt<=n and s[pt].l<=k[i]){ q.push(s[pt]); pt++; } while(!q.empty() and q.top().r<k[i])q.pop(); for(int f=0;f<k[i];f++){ if(q.empty())return 0; q.pop(); } } return 1; } /*int main(){ init(4,{1,2,2,2},{2,3,3,4}); cout<<can(2,{1,3})<<"\n"; cout<<can(2,{1,1})<<"\n"; return 0; }*/

Compilation message (stderr)

/usr/bin/ld: /tmp/ccCLehi3.o: in function `main':
grader.c:(.text.startup+0x242): undefined reference to `can(int, int*)'
collect2: error: ld returned 1 exit status