# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
975073 | 2024-05-04T11:33:20 Z | blackslex | Martian DNA (BOI18_dna) | C++17 | 41 ms | 4692 KB |
#include<bits/stdc++.h> using namespace std; int n, k, R, x, y; int main() { scanf("%d %d %d", &n, &k, &R); vector<int> a(n), req(k, -1), cnt(k); for (auto &e: a) scanf("%d", &e); for (int i = 0; i < R; i++) scanf("%d %d", &x, &y), req[x] = y; int cur = 0, ans = 1e9; for (int l = 0, r = 0; l < n; l++) { while (r < n && cur != R) { cnt[a[r]]++; if (cnt[a[r]] == req[a[r]]) cur++; r++; } if (cur == R) ans = min(ans, r - l); if (cnt[a[l]] == req[a[l]]) cur--; cnt[a[l]]--; } if (ans == 1e9) printf("impossible"); else printf("%d", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 344 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1372 KB | Output is correct |
2 | Correct | 14 ms | 1596 KB | Output is correct |
3 | Correct | 14 ms | 1624 KB | Output is correct |
4 | Correct | 14 ms | 1624 KB | Output is correct |
5 | Correct | 19 ms | 3132 KB | Output is correct |
6 | Correct | 14 ms | 1372 KB | Output is correct |
7 | Correct | 13 ms | 1596 KB | Output is correct |
8 | Correct | 18 ms | 4028 KB | Output is correct |
9 | Correct | 18 ms | 2140 KB | Output is correct |
10 | Correct | 14 ms | 1368 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 604 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 3412 KB | Output is correct |
2 | Correct | 24 ms | 3164 KB | Output is correct |
3 | Correct | 20 ms | 2908 KB | Output is correct |
4 | Correct | 15 ms | 1372 KB | Output is correct |
5 | Correct | 30 ms | 3924 KB | Output is correct |
6 | Correct | 41 ms | 4692 KB | Output is correct |
7 | Correct | 16 ms | 2136 KB | Output is correct |
8 | Correct | 18 ms | 2396 KB | Output is correct |
9 | Correct | 13 ms | 1372 KB | Output is correct |
10 | Correct | 14 ms | 1624 KB | Output is correct |
11 | Correct | 15 ms | 1628 KB | Output is correct |
12 | Correct | 14 ms | 1628 KB | Output is correct |
13 | Correct | 19 ms | 2908 KB | Output is correct |
14 | Correct | 13 ms | 1372 KB | Output is correct |
15 | Correct | 14 ms | 1628 KB | Output is correct |
16 | Correct | 18 ms | 3932 KB | Output is correct |
17 | Correct | 15 ms | 2140 KB | Output is correct |
18 | Correct | 13 ms | 1620 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 600 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 1 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 348 KB | Output is correct |
33 | Correct | 1 ms | 348 KB | Output is correct |