Submission #368404

#TimeUsernameProblemLanguageResultExecution timeMemory
368404RyoPhamXylophone (JOI18_xylophone)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> #include "xylophone.h" using namespace std; #define sz(x) (int)x.size() #define fi first #define se second typedef long long lli; typedef pair<int, int> pii; const int maxn = 5005; int n; int a[maxn]; void solve(int N) { n = N; int r = n - 1; while(query(1, r) == n - 1) --r; ++r; a[r] = n; int l = 2; while(query(2, l) == n - 1) ++l; --l; a[l] = 1; for(int i = 1; i < l; ++i) a[i] = query(i, l) + 1; for(int i = l + 1; i < r; ++i) a[i] = n - query(i, r); for(int i = r + 1; i <= n; ++i) a[i] = n - query(r, i); for(int i = 1; i <= n; ++i) answer(i, a[i]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...