제출 #1314136

#제출 시각아이디문제언어결과실행 시간메모리
1314136activedeltorreShortcut (IOI16_shortcut)C++20
컴파일 에러
0 ms0 KiB
include "shortcut.h" long long spar[100005]; using namespace std; #include <vector> int inf=1e17; long long dist(int a,int b,int c,int d,int add) { long long minim=inf; minim=min(minim,spar[b]-spar[a]); minim=min(minim,abs(spar[b]-spar[d])+abs(spar[a]-spar[c])+add); return minim; } long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c) { for(int i=2; i<=n; i++) { spar[i]=spar[i-1]+l[i-2]; } long long best=inf; for(int i=1; i<=n; i++) { for(int j=i+1; j<=n; j++) { long long worst=0; if(c<spar[j]-spar[i]) { for(int z=1; z<=n; z++) { for(int z2=z+1; z2<=n; z2++) { worst=max(worst,dist(z,z2,i,j,c)+d[z-1]+d[z2-1]); } } best=min(best,worst); } } } return best; }

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

shortcut.cpp:1:1: error: 'include' does not name a type
    1 | include "shortcut.h"
      | ^~~~~~~
shortcut.cpp:5:9: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+17' to '2147483647' [-Woverflow]
    5 | int inf=1e17;
      |         ^~~~
shortcut.cpp: In function 'long long int dist(int, int, int, int, int)':
shortcut.cpp:9:21: error: 'spar' was not declared in this scope
    9 |     minim=min(minim,spar[b]-spar[a]);
      |                     ^~~~
shortcut.cpp:10:21: error: 'abs' was not declared in this scope
   10 |     minim=min(minim,abs(spar[b]-spar[d])+abs(spar[a]-spar[c])+add);
      |                     ^~~
shortcut.cpp: In function 'long long int find_shortcut(int, std::vector<int>, std::vector<int>, int)':
shortcut.cpp:17:9: error: 'spar' was not declared in this scope
   17 |         spar[i]=spar[i-1]+l[i-2];
      |         ^~~~
shortcut.cpp:25:18: error: 'spar' was not declared in this scope
   25 |             if(c<spar[j]-spar[i])
      |                  ^~~~
shortcut.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
shortcut_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~