# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1033064 | vannnnnnnn | Martian DNA (BOI18_dna) | C++14 | 2032 ms | 3932 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |