# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040342 | 2024-08-01T01:42:57 Z | Nguyenhuutam | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3000 ms | 13116 KB |
#include <bits/stdc++.h> using namespace std; int a[1000005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> a[i]; while (m--) { int l, r, w; cin >> l >> r >> w; vector<int> b(r - l + 1); for (int j = 0; j < r - l + 1; j++) { b[j] = a[l + j]; } vector<int> c = b; sort(c.begin(), c.end()); bool res = true; for (int j = 0; j < c.size(); j++) { if (b[j] != c[j]) { int pos = find(b.begin() + j, b.end(), c[j]) - b.begin(); for (int k = pos; k > j; k--) { if (b[k] + b[k - 1] <= w) swap(b[k], b[k - 1]); else { res = false; break; } } if (!res) break; } } if (res) cout << 1 << '\n'; else cout << 0 << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 424 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 424 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 122 ms | 524 KB | Output is correct |
12 | Correct | 862 ms | 516 KB | Output is correct |
13 | Correct | 983 ms | 344 KB | Output is correct |
14 | Correct | 1571 ms | 344 KB | Output is correct |
15 | Correct | 1592 ms | 536 KB | Output is correct |
16 | Correct | 1254 ms | 344 KB | Output is correct |
17 | Execution timed out | 3013 ms | 536 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3078 ms | 13116 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3075 ms | 3472 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 424 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 122 ms | 524 KB | Output is correct |
12 | Correct | 862 ms | 516 KB | Output is correct |
13 | Correct | 983 ms | 344 KB | Output is correct |
14 | Correct | 1571 ms | 344 KB | Output is correct |
15 | Correct | 1592 ms | 536 KB | Output is correct |
16 | Correct | 1254 ms | 344 KB | Output is correct |
17 | Execution timed out | 3013 ms | 536 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 348 KB | Output is correct |
8 | Correct | 3 ms | 424 KB | Output is correct |
9 | Correct | 3 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 122 ms | 524 KB | Output is correct |
12 | Correct | 862 ms | 516 KB | Output is correct |
13 | Correct | 983 ms | 344 KB | Output is correct |
14 | Correct | 1571 ms | 344 KB | Output is correct |
15 | Correct | 1592 ms | 536 KB | Output is correct |
16 | Correct | 1254 ms | 344 KB | Output is correct |
17 | Execution timed out | 3013 ms | 536 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |