Submission #767950

#TimeUsernameProblemLanguageResultExecution timeMemory
767950MinaRagy06Rail (IOI14_rail)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; #ifdef MINA int getDistance(int i, int j) { cout << i << ' ' << j << endl; int x; cin >> x; return x; } #endif void findLocation(int n, int first, int location[], int stype[]) { location[0] = first, stype[0] = 1; if (n == 1) return; for (int i = 1; i < n; i++) { int x = getDistance(0, i), x2 = getDistance(i, 0); assert(x > 0), assert(x2 > 0); if (x2 == x) { location[i] = first + x; stype[i] = 2; } else { assert(x2 < x); location[i] = first - x2; stype[i] = 1; } } for (int i = 0; i < n; i++) { assert(location[i] > 0); assert(stype[i] == 1 || stype[i] == 2); if (stype[i] == 2) assert(location[i] > first); if (stype[i] == 1) assert(location[i] <= first); } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:17:17: error: 'getDistance' was not declared in this scope
   17 |         int x = getDistance(0, i), x2 = getDistance(i, 0);
      |                 ^~~~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from rail.cpp:1:
rail.cpp:18:31: error: 'x2' was not declared in this scope; did you mean 'x'?
   18 |         assert(x > 0), assert(x2 > 0);
      |                               ^~