제출 #718990

#제출 시각아이디문제언어결과실행 시간메모리
718990Karuk도시들 (IOI15_towns)C++14
컴파일 에러
0 ms0 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; map<pair<int,int>,int>m; int getmindist(int d1,int d2,int d3) { int d1=getDDD(f,s); int d2=getDDD(s,t); int d3=getDDD(f,t); int dd=(d1+d2-d3)/2; int d=(d1+d3-d2)/2; int ddd=(d2+d3-d1)/2; return max(max(d,dd),ddd); } int hubDistance(int n,int sub) { int maxd=0,maxind=0; int md=0; for(int i=1;i<n;i++) { int p=getDistance(0,i); m[{0,i}]=m[{i,0}]=p; if(maxd<p) { maxd=p; maxind=i; } } md=maxind; maxd=0; maxind=0; for(int i=0;i<n;i++) { if(i==md)continue; int p=getDDD(md,i); m[{md,i}]=m[{i,md}]=p; if(maxd<p) { maxd=p; maxind=i; } } int minr=INT_MAX; for(int i=0;i<n;i++) { if(i==md || i==maxind)continue; minr=min(minr,getmindist(maxd,m[{i,md}],getDistance(i,maxind)); } return minr; }

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

towns.cpp: In function 'int getmindist(int, int, int)':
towns.cpp:6:9: error: declaration of 'int d1' shadows a parameter
    6 |     int d1=getDDD(f,s);
      |         ^~
towns.cpp:5:20: note: 'int d1' previously declared here
    5 | int getmindist(int d1,int d2,int d3) {
      |                ~~~~^~
towns.cpp:6:19: error: 'f' was not declared in this scope
    6 |     int d1=getDDD(f,s);
      |                   ^
towns.cpp:6:21: error: 's' was not declared in this scope
    6 |     int d1=getDDD(f,s);
      |                     ^
towns.cpp:6:12: error: 'getDDD' was not declared in this scope
    6 |     int d1=getDDD(f,s);
      |            ^~~~~~
towns.cpp:7:9: error: declaration of 'int d2' shadows a parameter
    7 |     int d2=getDDD(s,t);
      |         ^~
towns.cpp:5:27: note: 'int d2' previously declared here
    5 | int getmindist(int d1,int d2,int d3) {
      |                       ~~~~^~
towns.cpp:7:21: error: 't' was not declared in this scope
    7 |     int d2=getDDD(s,t);
      |                     ^
towns.cpp:8:9: error: declaration of 'int d3' shadows a parameter
    8 |     int d3=getDDD(f,t);
      |         ^~
towns.cpp:5:34: note: 'int d3' previously declared here
    5 | int getmindist(int d1,int d2,int d3) {
      |                              ~~~~^~
towns.cpp:5:20: warning: unused parameter 'd1' [-Wunused-parameter]
    5 | int getmindist(int d1,int d2,int d3) {
      |                ~~~~^~
towns.cpp:5:27: warning: unused parameter 'd2' [-Wunused-parameter]
    5 | int getmindist(int d1,int d2,int d3) {
      |                       ~~~~^~
towns.cpp:5:34: warning: unused parameter 'd3' [-Wunused-parameter]
    5 | int getmindist(int d1,int d2,int d3) {
      |                              ~~~~^~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:30:15: error: 'getDDD' was not declared in this scope
   30 |         int p=getDDD(md,i);
      |               ^~~~~~
towns.cpp:40:71: error: expected ')' before ';' token
   40 |         minr=min(minr,getmindist(maxd,m[{i,md}],getDistance(i,maxind));
      |                 ~                                                     ^
      |                                                                       )
towns.cpp:14:27: warning: unused parameter 'sub' [-Wunused-parameter]
   14 | int hubDistance(int n,int sub) {
      |                       ~~~~^~~