# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
966117 | 2024-04-19T11:59:42 Z | blackslex | Alternating Heights (CCO22_day1problem1) | C++17 | 350 ms | 49112 KB |
#include<bits/stdc++.h> using namespace std; int n, k, q, x, y; int main() { scanf("%d %d %d", &n, &k, &q); vector<int> a(n + 5); vector<vector<int>> dp(n + 5, vector<int>(n + 5)); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); for (int i = 1; i <= n; i++) { vector<vector<int>> cnt(2, vector<int>(k + 5)); bool ck = 0; for (int j = i; j <= n; j++) { if (cnt[!(j & 1)][a[j]]) ck = 1; cnt[j & 1][a[j]]++; dp[i][j] = ck; } } while (q--) scanf("%d %d", &x, &y), printf("%s\n", dp[x][y] ? "NO" : "YES"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 48212 KB | Output is correct |
2 | Correct | 306 ms | 48084 KB | Output is correct |
3 | Correct | 292 ms | 47924 KB | Output is correct |
4 | Correct | 166 ms | 7248 KB | Output is correct |
5 | Correct | 181 ms | 9556 KB | Output is correct |
6 | Correct | 292 ms | 47956 KB | Output is correct |
7 | Correct | 283 ms | 47836 KB | Output is correct |
8 | Correct | 275 ms | 48208 KB | Output is correct |
9 | Correct | 286 ms | 48224 KB | Output is correct |
10 | Correct | 350 ms | 48468 KB | Output is correct |
11 | Correct | 294 ms | 49112 KB | Output is correct |
12 | Correct | 246 ms | 48468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 191 ms | 12060 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 294 ms | 48212 KB | Output is correct |
2 | Correct | 306 ms | 48084 KB | Output is correct |
3 | Correct | 292 ms | 47924 KB | Output is correct |
4 | Correct | 166 ms | 7248 KB | Output is correct |
5 | Correct | 181 ms | 9556 KB | Output is correct |
6 | Correct | 292 ms | 47956 KB | Output is correct |
7 | Correct | 283 ms | 47836 KB | Output is correct |
8 | Correct | 275 ms | 48208 KB | Output is correct |
9 | Correct | 286 ms | 48224 KB | Output is correct |
10 | Correct | 350 ms | 48468 KB | Output is correct |
11 | Correct | 294 ms | 49112 KB | Output is correct |
12 | Correct | 246 ms | 48468 KB | Output is correct |
13 | Incorrect | 191 ms | 12060 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |