Submission #1116612

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11166122024-11-22 02:01:24gustavo_dXylophone (JOI18_xylophone)C++17
100 / 100
201 ms956 KiB
#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
int a1[5001], a2[5001];
void solve(int N) {
int n = N;
int pos1=1;
a1[pos1] = 1;
a2[pos1] = 1;
a1[pos1+1] = 1-query(pos1, pos1+1);
a2[pos1+1] = query(pos1, pos1+1) + 1;
for (int pt = pos1+2; pt<=n; pt++) {
int q1 = query(pt-1, pt), q2 = query(pt-2, pt);
int d1 = abs(a1[pt-1] - a1[pt-2]);
int d = q1;
if (a1[pt-2] < a1[pt-1]) {
if (q2 == d + d1) a1[pt] = a1[pt-1] + d;
else a1[pt] = a1[pt-1] - d;
} else {
if (q2 == d + d1) a1[pt] = a1[pt-1] - d;
else a1[pt] = a1[pt-1] + d;
}
d1 = abs(a2[pt-1] - a2[pt-2]);
if (a2[pt-2] < a2[pt-1]) {
if (q2 == d + d1) a2[pt] = a2[pt-1] + d;
else a2[pt] = a2[pt-1] - d;
} else {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...