Submission #763665

# Submission time Handle Problem Language Result Execution time Memory
763665 2023-06-22T15:14:56 Z vjudge1 Xylophone (JOI18_xylophone) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "xylophone.h"
using namespace std;
#define ll long long
const ll maxn = 2e5 + 69;
ll ans[maxn],p[maxn],trio[maxn];
ll minn,maxx;
void solve(ll n){
	for(int i = 1;i<n;i++){
		p[i] = query(i,i+1);
	}
	for(int i = 1;i<n-1;i++){
		trio[i] = query(i,i+2);
	}
	ans[1] = 0;
	ans[2] = p[1];
	for(int i = 3;i<=n;i++){
		if(p[i-1] + p[i-2] == trio[i-2]){
			if(ans[i-1] > ans[i-2]){
				ans[i] = ans[i-1] + p[i-1];
			}else{
				ans[i] = ans[i-1] - p[i-1];
			}
		}else{
			if(ans[i-1] < ans[i-2]){
				ans[i] = ans[i-1] + p[i-1];
			}else{
				ans[i] = ans[i-1] - p[i-1];
			}
		}
	}
	minn = 1,maxx = 1;
	for(int i = 1;i<=n;i++){
		if(ans[i] < ans[minn]){
			minn = i;
		}
		if(ans[i] > ans[maxx]){
			maxx = i;
		}
	}
	ll temp = ans[minn];
	for(int i = 1;i<=n;i++){
		ans[i] = ans[i] - temp + 1;
	}
	if(minn > maxx){
		for(int i = 1;i<=n;i++){
			ans[i] = n - ans[i] + 1;
		}
	}
	for(int i = 1;i<=n;i++) answer(i,ans[i]);
}

Compilation message

/usr/bin/ld: /tmp/ccI7POPY.o: in function `main':
grader.cpp:(.text.startup+0x30): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status