제출 #125648

#제출 시각아이디문제언어결과실행 시간메모리
125648tmwilliamlin168철로 (IOI14_rail)C++14
컴파일 에러
0 ms0 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; const int mxN=5e3; array<int, 2> a[mxN]; map<int, int> mp; void findLocation(int n, int f, int *p, int *s) { p[0]=f; s[0]=1; mp[f]=0; for(int i=1; i<n; ++i) a[i]={getDistance(0, i), i}; sort(a, a+n); int l=0, r=a[1][1]; p[r]=f+a[1][0]; s[r]=2; mp[p[r]]=r; for(int i=2; i<n; ++i) { assert(mp.find((p[l]+dl+p[r]-dr)/2)!=mp.end()); int dl=getDistance(l, a[i][1]), dr=getDistance(r, a[i][1]), t=s[mp[(p[l]+dl+p[r]-dr)/2]]; if(t^2) { p[a[i][1]]=p[l]+dl; s[a[i][1]]=2; if(p[a[i][1]]>p[r]) r=a[i][1]; } else { p[a[i][1]]=p[r]-dr; s[a[i][1]]=1; if(p[a[i][1]]<p[l]) l=a[i][1]; } mp[p[a[i][1]]]=a[i][1]; } }

컴파일 시 표준 에러 (stderr) 메시지

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from rail.cpp:2:
rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:21:24: error: 'dl' was not declared in this scope
   assert(mp.find((p[l]+dl+p[r]-dr)/2)!=mp.end());
                        ^
rail.cpp:21:24: note: suggested alternative: 'l'
rail.cpp:21:32: error: 'dr' was not declared in this scope
   assert(mp.find((p[l]+dl+p[r]-dr)/2)!=mp.end());
                                ^
rail.cpp:21:32: note: suggested alternative: 'r'