# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
768313 | Yell0 | Martian DNA (BOI18_dna) | C++17 | 68 ms | 9236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MN=2e5+2;
int N,K,R,d[MN],req[MN],f[MN];
int main() {
ios::sync_with_stdio(0);cin.tie(0);
cin>>N>>K>>R;
for(int i=1;i<=N;++i) cin>>d[i];
set<int> needs;
for(int i=1;i<=R;++i) {
int b,q;
cin>>b>>q;
req[b]=q;
needs.insert(b);
}
int l=1,r=1;
for(;r<=N;++r) {
if(needs.empty()) break;
if(++f[d[r]]==req[d[r]]) needs.erase(d[r]);
}
if(r>N&&needs.size()) {
cout<<"impossible\n";
return 0;
}
int ans=r-l;
for(;l<=N;++l) {
--f[d[l]];
while(f[d[l]]<req[d[l]]) {
# | 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... |