# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097119 | 2024-10-06T06:02:16 Z | vjudge1 | Xor Sort (eJOI20_xorsort) | C++17 | 1 ms | 344 KB |
#include "bits/stdc++.h" const signed MOD = 1e9 + 7; const signed mod = 998244353; using namespace std; #define all(x) x.begin(), x.end() #define ld long double #define ll long long #define pb push_back #define mp make_pair #define co cout << #define S second #define F first ll n, a[1000001]; bool sol(ll x) { ll t = x; vector<pair<ll, ll>> s; for (int i = 0; i < n * 2; i++) { if (a[i] <= t) { t += a[i]; while (s.size() && s.back().F <= t) { t += s.back().S; s.pop_back(); } } else { s.pb(mp(a[i], t - x + a[i])); t = x; } } return (s.empty()); } void solve() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; a[i + n] = a[i]; } ll l = 0, r = 1e13; while (l < r) { ll m = l + r >> 1; if (sol(m)) r = m; else l = m + 1; } co l; } signed main() { cin.tie(0)->sync_with_stdio(0); signed t = 1; // cin >> t; while (t--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Integer 499946 violates the range [0, 40000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Integer 499946 violates the range [0, 40000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Integer 308179 violates the range [0, 40000] |
2 | Halted | 0 ms | 0 KB | - |