Submission #702815

#TimeUsernameProblemLanguageResultExecution timeMemory
702815kxdXylophone (JOI18_xylophone)C++17
Compilation error
0 ms0 KiB
#include 'xylophone.h'
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second

using namespace std;
const int N = 6969;
const int INF = 1e18;
const int MOD = 1e9+7;

int a[N];
int nx2[N];
int nx3[N];
bool b[N];

void solve(int n) {
	memset(a,0,sizeof(a));
	memset(nx2,0,sizeof(nx2));
	memset(nx3,0,sizeof(nx3));
	memset(b,0,sizeof(b));
	forn1(i,n) {
		nx2[i] = query(i, i+1);
	}
	forn1(i,n-1) {
		nx3[i] = query(i, i+2);
	}
	FOR(i,2,n-1) {
		b[i] = (nx3[i-1] != nx2[i]+nx2[i-1]);
	}
	a[1] = 1;
	bool flag = 1;
	FOR(i,2,n) {
		a[i] = a[i-1];
		if(flag) {
			a[i] += nx2[i-1];
		} else {
			a[i] -= nx2[i-1];
		}
		flag = (flag!=b[i]);
	}
	int mini = 0;
	a[0]=INF;
	forn1(i,n) {
		if(a[i] < a[mini]) mini = i;
	}
	int pos1 = -1;
	int posn = -1;
	forn1(i,n) {
		a[i] += 1-a[mini];
		if(a[i] == 1) pos1 = i;
		if(a[i] == n) posn = i;
	}
	if(pos1>posn) {
		forn1(i,n) {
			a[i] = n-a[i];
		}
	}
	forn1(i,n) {
		answer(i, a[i]);
	}
}

Compilation message (stderr)

xylophone.cpp:1:10: error: #include expects "FILENAME" or <FILENAME>
    1 | #include 'xylophone.h'
      |          ^~~~~~~~~~~~~
xylophone.cpp: In function 'void solve(long long int)':
xylophone.cpp:34:12: error: 'query' was not declared in this scope
   34 |   nx2[i] = query(i, i+1);
      |            ^~~~~
xylophone.cpp:37:12: error: 'query' was not declared in this scope
   37 |   nx3[i] = query(i, i+2);
      |            ^~~~~
xylophone.cpp:71:3: error: 'answer' was not declared in this scope
   71 |   answer(i, a[i]);
      |   ^~~~~~