Submission #704657

#TimeUsernameProblemLanguageResultExecution timeMemory
704657bebraXylophone (JOI18_xylophone)C++17
0 / 100
1 ms208 KiB
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { vector<int> a(n); vector<int> pos(n); int l = 0; int r = n - 1; while (l < n - 1) { if (query(l + 1, r) == n - 1) { ++l; } else { break; } } a[l] = 1; int curr_max = 0; for (int i = l + 1; i < n; ++i) { a[i] = query(l + 1, i + 1); if (a[i] > curr_max) { curr_max = a[i]; } else { a[i] = a[i - 1] - query(i - 1 + 1, i + 1); } } for (int i = l - 1; i >= 0; --i) { a[i] = query(i + 1, l + 1); if (a[i] > curr_max) { curr_max = a[i]; } else { a[i] = a[i - 1] - query(i + 1, i + 1 + 1); } } 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...