| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 373112 | mariowong | Martian DNA (BOI18_dna) | C++14 | 41 ms | 4608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int m,q,n,ans,l,r,u,v,ct[200005],now[200005],ok,a[200005];
int main(){
ios::sync_with_stdio(false);
cin >> n >> m >> q;
for (int i=1;i<=n;i++){
cin >> a[i];
}
for (int i=1;i<=q;i++){
cin >> u >> v;
ct[u]=v;
}
l=1; r=0; ans=1e9;
while (l <= n && r <= n){
if (ok == q){
ans=min(ans,r-l+1);
if (now[a[l]] == ct[a[l]])
ok--;
now[a[l]]--;
l++;
}
else
{
r++;
now[a[r]]++;
if (now[a[r]] == ct[a[r]])
ok++;
}
}
if (ans == 1e9)
cout << "impossible\n";
else
cout << ans << "\n";
return 0;
} | # | 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... | ||||
