Submission #139101

#TimeUsernameProblemLanguageResultExecution timeMemory
139101ibrahim001Rail (IOI14_rail)C++14
Compilation error
0 ms0 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 ( 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 ( 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; } } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:18:11: error: 'i' was not declared in this scope
     for ( i = 1; i < n; i++ )
           ^
rail.cpp:29:11: error: 'i' was not declared in this scope
     for ( i = 1; i < n; i++ )
           ^
rail.cpp:34:19: error: 'k2' was not declared in this scope
         if ( k1 < k2 )
                   ^~
rail.cpp:34:19: note: suggested alternative: 'k1'
         if ( k1 < k2 )
                   ^~
                   k1