제출 #139102

#제출 시각아이디문제언어결과실행 시간메모리
139102ibrahim001철로 (IOI14_rail)C++14
30 / 100
84 ms500 KiB
#include "rail.h" #include <bits/stdc++.h> #define intt long long #define pb push_back #define F first #define S second #define endl '\n' using namespace std; const int inf = 1e9; void findLocation(int N, int first, int location[], int stype[]) { int n = N; location[0]=first; stype[0]=1; if ( N == 1 ) return; int best,minn=inf; for ( int i = 1; i < n; i++ ) { int k = getDistance(0,i); if ( k < minn ) { minn = k; best = i; } } stype[best] = 2; location[best] = first+minn; for ( int i = 1; i < n; i++ ) { if ( i == best ) continue; int k1=getDistance(0,i),k2=getDistance(best,i); if ( k1 < k2 ) { stype[i] = 2; location[i] = first+k1; } else { stype[i] = 1; location[i] = location[best]-k2; } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:27:15: warning: 'best' may be used uninitialized in this function [-Wmaybe-uninitialized]
     stype[best] = 2;
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...