제출 #387399

#제출 시각아이디문제언어결과실행 시간메모리
387399alishahali1382Towns (IOI15_towns)C++14
0 / 100
19 ms1132 KiB
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define debug2(x, y) {cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<"\n";}
#define pb push_back
#define all(x) x.begin(), x.end()

const int mod=1000000007;
const int N=120;

int n, m, k, ans;
int D[N][N];

int ask(int i, int j){
	if (i==j) return 0;
	if (i>j) swap(i, j);
	if (D[i][j]==-1) D[i][j]==getDistance(i, j);
	return D[i][j];
}

int hubDistance(int n, int sub){
	memset(D, -1, sizeof(D));
	int X=0, Y=0;
	for (int i=1; i<n; i++) if (ask(0, i)>ask(0, X)) X=i;
	for (int i=1; i<n; i++) if (ask(X, i)>ask(X, Y)) Y=i;
	return ask(X, Y);
}

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

towns.cpp: In function 'int ask(int, int)':
towns.cpp:22:26: warning: value computed is not used [-Wunused-value]
   22 |  if (D[i][j]==-1) D[i][j]==getDistance(i, j);
      |                   ~~~~~~~^~~~~~~~~~~~~~~~~~~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:26:31: warning: declaration of 'n' shadows a global declaration [-Wshadow]
   26 | int hubDistance(int n, int sub){
      |                               ^
towns.cpp:16:5: note: shadowed declaration is here
   16 | int n, m, k, ans;
      |     ^
towns.cpp:26:28: warning: unused parameter 'sub' [-Wunused-parameter]
   26 | int hubDistance(int n, int sub){
      |                        ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...