# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1040314 | 2024-08-01T00:54:33 Z | vjudge1 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3000 ms | 21184 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 356 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 356 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 356 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 356 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 111 ms | 600 KB | Output is correct |
12 | Correct | 835 ms | 620 KB | Output is correct |
13 | Correct | 954 ms | 680 KB | Output is correct |
14 | Correct | 1658 ms | 692 KB | Output is correct |
15 | Correct | 1628 ms | 660 KB | Output is correct |
16 | Correct | 1238 ms | 604 KB | Output is correct |
17 | Execution timed out | 3050 ms | 612 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3059 ms | 21184 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3065 ms | 2256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 356 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 356 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 111 ms | 600 KB | Output is correct |
12 | Correct | 835 ms | 620 KB | Output is correct |
13 | Correct | 954 ms | 680 KB | Output is correct |
14 | Correct | 1658 ms | 692 KB | Output is correct |
15 | Correct | 1628 ms | 660 KB | Output is correct |
16 | Correct | 1238 ms | 604 KB | Output is correct |
17 | Execution timed out | 3050 ms | 612 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 476 KB | Output is correct |
7 | Correct | 4 ms | 356 KB | Output is correct |
8 | Correct | 3 ms | 348 KB | Output is correct |
9 | Correct | 3 ms | 356 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 111 ms | 600 KB | Output is correct |
12 | Correct | 835 ms | 620 KB | Output is correct |
13 | Correct | 954 ms | 680 KB | Output is correct |
14 | Correct | 1658 ms | 692 KB | Output is correct |
15 | Correct | 1628 ms | 660 KB | Output is correct |
16 | Correct | 1238 ms | 604 KB | Output is correct |
17 | Execution timed out | 3050 ms | 612 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |