Submission #1029387

#TimeUsernameProblemLanguageResultExecution timeMemory
1029387XJP12Boxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int delivery(int n, int k, int l, vi positions){ if(k==1){ int ans=0; for(int i=0; i<n; i++){ ans+=min(positions[i],n-positions[i])*2; } return ans; } if(k==n){ vi pos; set<int> z; for(int i=0; i<n; i++){ int size=(int)z.size(); z.insert(positions[i]); if((int)z.size()!=size){ pos.push_back(positions[i]); } } int x = (int)(lower_bound(pos.begin(), pos.end(), l/2) - pos.begin()); int y = (int)(upper_bound(pos.begin(), pos.end(), l/2) - pos.begin()); x--; int ans=0; ans+=pos[x]*2; ans+=(n-pos[y])*2; ans=min(l, ans); return ans; } return 0; }

Compilation message (stderr)

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