Submission #1274923

#TimeUsernameProblemLanguageResultExecution timeMemory
1274923muhammad-ahmadIsland Hopping (JOI24_island)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

signed main(){
    int N, L; cin >> N >> L;
    int cur = 1, F[N + 1] = {}, Ex[N + 1] = {};
    
    bool vis[N];
    map<pair<int, int>, bool> C;
    
    vis[1] = 1;
    
    for (int i = 1; i <= N; i++){
    	int f = query(cur, 1);
    	int ex = query(cur, 2);
    	
    	if (vis[f]){
    		if (!C[{cur, f}] && !C[{f, cur}]){
    			answer(cur, f);
    			C[{cur, f}] = 1;
    		}
    		if (!C[{cur, ex}] && !C[{ex, cur}]){
    			answer(cur, ex);
    			C[{cur, ex}] = 1;
    		}
    		vis[ex] = 1;
    		vis[f] = 1;
    		cur = ex;
    	}
    	
    	else {
    		if (!C[{cur, f}] && !C[{f, cur}]){
    			answer(cur, f);
    			C[{cur, f}] = 1;
    		}
    		vis[f] = 1;
    		cur = ex;
    	}
    	
    }
    
	return 0;
}

Compilation message (stderr)

island.cpp: In function 'int main()':
island.cpp:17:17: error: 'query' was not declared in this scope
   17 |         int f = query(cur, 1);
      |                 ^~~~~
island.cpp:22:25: error: 'answer' was not declared in this scope
   22 |                         answer(cur, f);
      |                         ^~~~~~
island.cpp:26:25: error: 'answer' was not declared in this scope
   26 |                         answer(cur, ex);
      |                         ^~~~~~
island.cpp:36:25: error: 'answer' was not declared in this scope
   36 |                         answer(cur, f);
      |                         ^~~~~~