# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772996 | 2023-07-04T13:51:27 Z | Imeon | A Difficult(y) Choice (BOI21_books) | C++17 | 186 ms | 1076 KB |
#include<bits/stdc++.h> #include"books.h" using namespace std; void solve(int N, int K, long long A, int S) { // cin >> N >> K >> S >> A; long long x[N + 1]; long long sm = 0; int f = 0; K--; for (int i = 1; i <= N;i++){ x[i] = skim(i); if (i <= K)sm += x[i]; } int l = K,r = N + 1; while (l + 1 < r){ int md = (l + r) / 2; if ((x[md] + sm) > 2ll * A)r = md; else l = md; } sm += x[l]; if (l == K or sm > 2LL * A)impossible(); if (sm >= A and sm <= 2LL * A){ vector<int>v; for (int j = 1; j <= K; j++){ v.push_back(j); } v.push_back(l); answer(v); } K++; sm = 0; for (int i = 1; i <= N;i++){ sm += x[i]; if (i > K){sm -= x[i - K];} if (i >= K and sm >= A and sm <= 2LL * A){ vector<int>v; for (int j = i - K + 1; j <= i; j++){ v.push_back(j); } answer(v); } } impossible(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 208 KB | Output is correct |
2 | Correct | 9 ms | 208 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 8 ms | 208 KB | Output is correct |
5 | Correct | 8 ms | 208 KB | Output is correct |
6 | Correct | 8 ms | 208 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 208 KB | Output is correct |
2 | Correct | 9 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 5 ms | 208 KB | Output is correct |
5 | Correct | 7 ms | 208 KB | Output is correct |
6 | Correct | 8 ms | 208 KB | Output is correct |
7 | Correct | 4 ms | 208 KB | Output is correct |
8 | Correct | 8 ms | 208 KB | Output is correct |
9 | Correct | 138 ms | 464 KB | Output is correct |
10 | Correct | 124 ms | 464 KB | Output is correct |
11 | Correct | 186 ms | 464 KB | Output is correct |
12 | Correct | 113 ms | 464 KB | Output is correct |
13 | Correct | 163 ms | 464 KB | Output is correct |
14 | Correct | 140 ms | 464 KB | Output is correct |
15 | Correct | 134 ms | 464 KB | Output is correct |
16 | Correct | 180 ms | 464 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1076 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1076 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1076 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1076 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1076 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |