제출 #784285

#제출 시각아이디문제언어결과실행 시간메모리
784285Lyrically도시들 (IOI15_towns)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "towns.h" using namespace std; #define pii pair<int,int> #define pb push_back #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) int read(){int x;scanf("%d",&x);return x;} void print(int x){printf("%d\n",x);} void file(string s) { freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } const int mod=998244353; int N,S; int Dis[115][115]; int getDistance(int i,int j) { return Dis[i][j]; } int hubDistance(int n,int subtsk) { if(subtsk==1) { int dis[115][115]; rep(i,n) { for(int j=i+1;j<n;j++) { int d=getDistance(i,j); dis[i][j]=dis[j][i]=d; } } int mx=0,l=0,r=0; rep(i,n) { for(int j=i+1;j<n;j++) { if(dis[i][j]>mx) { mx=dis[i][j]; l=i; r=j; } } } //cout<<l<<" "<<r<<" "<<mx<<endl; int res=(1<<30); rep(i,n) { if(i==l||i==r){continue;} int fi=dis[i][l],se=dis[i][r]; if((fi+se-mx)&1){continue;} int inter=(fi+se-mx)/2; int l=fi-inter,r=se-inter; res=min(res,max(l,r)); } return res; } return 0; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:56:8: warning: declaration of 'l' shadows a previous local [-Wshadow]
   56 |    int l=fi-inter,r=se-inter;
      |        ^
towns.cpp:35:12: note: shadowed declaration is here
   35 |   int mx=0,l=0,r=0;
      |            ^
towns.cpp:56:19: warning: declaration of 'r' shadows a previous local [-Wshadow]
   56 |    int l=fi-inter,r=se-inter;
      |                   ^
towns.cpp:35:16: note: shadowed declaration is here
   35 |   int mx=0,l=0,r=0;
      |                ^
towns.cpp: In function 'int read()':
towns.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 | int read(){int x;scanf("%d",&x);return x;}
      |                  ~~~~~^~~~~~~~~
towns.cpp: In function 'void file(std::string)':
towns.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen((s+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
towns.cpp:13:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  freopen((s+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cclxBVjx.o: in function `getDistance(int, int)':
grader.c:(.text+0x110): multiple definition of `getDistance(int, int)'; /tmp/ccD9WKeB.o:towns.cpp:(.text+0x2b0): first defined here
collect2: error: ld returned 1 exit status