Submission #337269

#TimeUsernameProblemLanguageResultExecution timeMemory
337269RegisterStations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef vector<int> vec; const int N=205; int n,ns,a[N],b[N],ans[N]; inline bool cmp1(const int&x,const int&y) {return b[x]==b[y]?a[x]<a[y]:b[x]<b[y];} inline bool cmp2(const int&x,const int&y) {return atan2(a[x]-a[ns],b[x]-b[ns])<atan2(a[y]-a[ns],b[y]-b[ns]);} inline void add(int x,int y) {ans[min(x,y)]=max(x,y)-n;} void solve(vec s){ sort(s.begin(),s.end(),cmp1); ns=s[0];s.erase(s.begin()); stable_sort(s.begin(),s.end(),cmp2);vec t; for(int c=0,x;;){ x=s[0];s.erase(s.begin()); if((x>n)^(ns>n)) c++;else c--; if(c>0){ add(ns,x); if(!s.empty()) solve(s); if(!t.empty()) solve(t); break; } t.push_back(x); } } signed main(){ scanf("%d",&n);vec s; for(int i=1;i<=n*2;i++) {scanf("%d%d",&a[i],&b[i]);s.push_back(i);} solve(s); for(int i=1;i<=n;i++) printf("%d\n",ans[i]); return 0; } //test

Compilation message (stderr)

stations.cpp: In function 'int main()':
stations.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |  scanf("%d",&n);vec s;
      |  ~~~~~^~~~~~~~~
stations.cpp:27:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   27 |  for(int i=1;i<=n*2;i++) {scanf("%d%d",&a[i],&b[i]);s.push_back(i);}
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~
/tmp/cc6HyWpF.o: In function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccB9p12y.o:stations.cpp:(.text.startup+0x0): first defined here
/tmp/cc6HyWpF.o: In function `main':
stub.cpp:(.text.startup+0x29a): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
stub.cpp:(.text.startup+0x4bc): undefined reference to `find_next_station(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status