# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1033064 | 2024-07-24T12:31:18 Z | vannnnnnnn | Martian DNA (BOI18_dna) | C++14 | 2000 ms | 3932 KB |
#include<bits/stdc++.h> using namespace std; int note[200005], lst[200005], mp[200005], a[200005]; int main() { int n, k, r, ans=1e9; scanf("%d %d %d", &n, &k, &r); for(int i=1; i<=n; i++) { scanf("%d", &a[i]); } for(int i=1; i<=r; i++) { int c, d; scanf("%d %d", &c, &d); note[c]=d; lst[i]=c; } int start=1; for(int i=1; i<=n; i++) { mp[a[i]]++; int find=1; for(int j=1; j<=r; j++) { if(mp[lst[j]]<note[lst[j]]) { find=0; break; } } if(find==1) { while(start<i) { if(mp[a[start]]-1>=note[a[start]]) { mp[a[start]]--; start++; } else { break; } } ans=min(ans, i-start+1); } } if(ans==1e9)printf("impossible\n"); else printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 0 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 604 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 | 444 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 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 | 1 ms | 344 KB | Output is correct |
6 | Correct | 1 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 | 1 ms | 2396 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 2492 KB | Output is correct |
14 | Correct | 1 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 2908 KB | Output is correct |
2 | Correct | 13 ms | 1628 KB | Output is correct |
3 | Correct | 16 ms | 1572 KB | Output is correct |
4 | Correct | 13 ms | 1640 KB | Output is correct |
5 | Correct | 26 ms | 2520 KB | Output is correct |
6 | Correct | 10 ms | 1628 KB | Output is correct |
7 | Correct | 14 ms | 1628 KB | Output is correct |
8 | Correct | 16 ms | 3932 KB | Output is correct |
9 | Correct | 24 ms | 2216 KB | Output is correct |
10 | Correct | 11 ms | 1624 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 | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 1 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 | Execution timed out | 2032 ms | 3664 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |