Submission #702824

#TimeUsernameProblemLanguageResultExecution timeMemory
702824kxdXylophone (JOI18_xylophone)C++17
0 / 100
0 ms336 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 = 1e9; const int MOD = 1e9+7; static int a[N]; static int nx2[N]; static int nx3[N]; static 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; int m=a[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]); m = min(m,a[i]); } int pos1 = -1; int posn = -1; forn1(i,n) { a[i] += 1-m; 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]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...