Submission #1059936

# Submission time Handle Problem Language Result Execution time Memory
1059936 2024-08-15T09:28:24 Z Alihan_8 Island Hopping (JOI24_island) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
//--------------------------------------------------------------------//
// Don't change this part of the code!!!
#ifdef ONLINE_JUDGE
int query(int v, int k) {
    cout << "que " << v << " " << k << endl;
    fflush(stdout);
    int x;
    cin >> x;
    return x;
}
void answer(int x, int y) {
    cout << "ans " << x << " " << y << endl;
    fflush(stdout);
}
#else
#include "grader.cpp"
int query(int v, int k) {
    return Query(v, k);
}
void answer(int x, int y) {
    Answer(x, y);
}
#endif
//--------------------------------------------------------------------//

#define pb push_back
#define all(x) x.begin(), x.end()
#define ln '\n'

void solve(int n, int _L){
	vector <int> p, q(n + 1);
	
	for ( int i = 0; i + 1 < n; i++ ){
		int x = query(1, i + 1);
		
		p.pb(x); q[x] = i;
	}
	
	vector <int> fa(n + 1);
	
	reverse(all(p));
	
	for ( auto &u: p ){
		if ( fa[u] ) continue;
		
		int v = -1, k = 0;
		
		while ( q[v = query(u, ++k)] > q[u] ){
			fa[v] = u;
		}
		
		fa[u] = v;
	}
	
	for ( int i = 2; i <= n; i++ ){
		answer(i, fa[i]);
	}
}

//--------------------------------------------------------------------//
// Don't change this part of the code!!!
#ifdef ONLINE_JUDGE
int main() {
    int N, L;
    cin >> N >> L;
    
    solve(N, L);
    
    cout << "finish 1 1" << endl;
    fflush(stdout);
    
    return 0;
}
#endif
//--------------------------------------------------------------------//


/*

4 16
1 2
2 4
4 3

*/

Compilation message

island.cpp:18:10: fatal error: grader.cpp: No such file or directory
   18 | #include "grader.cpp"
      |          ^~~~~~~~~~~~
compilation terminated.