이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC Optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,pairll>pairllll;
typedef long double ld;
typedef pair<ll,string>pairls;
#define INF 1000000000000007
#define MOD 1000000007
#define pb push_back
#define fr first
#define sc second
#define endl '\n'
ll n,k,d[200007],f[200007];
int main() {
cin>>n>>k>>k;
for(int i=1;i<=n;i++){
cin>>d[i];
}
for(int i=1;i<=k;i++){
ll x,y;
cin>>x>>y;
f[x]=y;
}
ll l=1;
ll r=0;
ll res=INF;
for(int i=1;i<=n;i++){
r=i;
f[d[r]]--;
if(f[d[r]]==0)k--;
while(l<r && f[d[l]]<0){
f[d[l]]++;
l++;
}
if(k==0)res=min(res,r-l+1);
}
if(res==INF)cout<<"impossible"<<endl;
else cout<<res<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
dna.cpp:1: warning: ignoring '#pragma GCC Optimize' [-Wunknown-pragmas]
1 | #pragma GCC Optimize("O3")
|
# | 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... |