제출 #867902

#제출 시각아이디문제언어결과실행 시간메모리
867902LibShortcut (IOI16_shortcut)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "shortcut.h" using namespace std; long long lim=1000000000000000000; long long BoundTopLeft,BoundTopRight,BoundBottomLeft,BoundBottomRight; //Where the lines that forms the current bound cuts the X-axis long long TopLeft,TopRight,BottomLeft,BottomRight; //Where the lines that forms the current square cuts the Y-axis int n; long long Mainline[1000003]; long long Secondline[1000003]; long long PrefixMax[1000003]; long long PrefixMaxpos[1000003]; long long Extraline; long long C,X,Y; long long cntok; long long PossibleDiameter(long long Dist){ //Dist=8; BoundTopLeft=-lim; BoundTopRight=lim; BoundBottomLeft=-lim; BoundBottomRight=lim; cntok=0; for(int k=1;k<n;k++){ for(int i=k+1;i<=n;i++){ C=Dist-(Extraline+Secondline[i]+Secondline[k]); X=Mainline[i]; Y=Mainline[k]; TopLeft=X-C-Y; TopRight=X+C+Y; BottomLeft=X-C+Y; BottomRight=X+C-Y; if((Secondline[i]+Secondline[k]+Mainline[i]-Mainline[k])>Dist){ BoundTopLeft=max(BoundTopLeft,TopLeft); BoundTopRight=min(BoundTopRight,TopRight); BoundBottomRight=min(BoundBottomRight,BottomRight); BoundBottomLeft=max(BoundBottomLeft,BottomLeft); } } } if(BoundTopLeft>BoundBottomRight||BoundBottomLeft>BoundTopRight){ return 0; } for(int k=1;k<n;k++){ for(int l=k+1;l<=n;l++){ if((BoundTopLeft <= Mainline[l]-Mainline[k])&&(Mainline[l]-Mainline[k] <= BoundBottomRight)&&(BoundBottomLeft <= Mainline[k]+Mainline[l])&&(Mainline[k]+Mainline[l] <= BoundTopRight)){ return 1; } if((Secondline[l]+Secondline[k]+Mainline[l]-Mainline[k])>Dist){ }else{ cntok++; } } } if(cntok==n*(n-1)/2){ return 1; } return 0; } long long find_shortcut(int N, int[] l, int[] d, int c){ long long temp=0; for(int i=2;i<=n;i++){ temp=l[i-2]; Mainline[i]=Mainline[i-1]+temp; } for(int i=1;i<=n;i++){ Secondline[i]=d[i-1]; } Extraline=c; long long l=1,r=lim; long long mid; while(r-l>=1){ mid=(r+l)/2; if(PossibleDiameter(mid)){ r=mid; }else{ l=mid+1; } } if(PossibleDiameter(l)){ return l; }else if(PossibleDiameter(r)){ return r; } }

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

shortcut.cpp:60:38: error: expected ',' or '...' before 'l'
   60 | long long find_shortcut(int N, int[] l, int[] d, int c){
      |                                      ^
shortcut.cpp: In function 'long long int find_shortcut(int, int*)':
shortcut.cpp:63:8: error: 'l' was not declared in this scope
   63 |   temp=l[i-2];
      |        ^
shortcut.cpp:67:17: error: 'd' was not declared in this scope
   67 |   Secondline[i]=d[i-1];
      |                 ^
shortcut.cpp:69:12: error: 'c' was not declared in this scope
   69 |  Extraline=c;
      |            ^
shortcut.cpp:85:1: warning: control reaches end of non-void function [-Wreturn-type]
   85 | }
      | ^