제출 #1310424

#제출 시각아이디문제언어결과실행 시간메모리
1310424Samakahhh Martian DNA (BOI18_dna)C++20
0 / 100
2096 ms1856 KiB
#include <bits/stdc++.h> #define endl "\n" using namespace std; typedef long long ll ; vector<ll>primes; ll fa[1000]; ll req[1000]; ll ta[1000]; //total accurance ll have[1000]; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) ; ll n,k,r; cin >>n>>k>>r; ll a[n]; for(ll i=0;i<n;i++){ cin >>a[i]; ta[a[i]]++; } ll mn=999999; while(r--){ ll x,y; cin >>x>>y; req[x]=y; } for(ll i=0;i<n;i++){ for(ll w=0;w<=k;w++){ fa[w]=0; } for(ll j=i;j<n;j++){ fa[a[j]]++; bool is=1; for(ll l=0;l<=k;l++){ if(fa[l]<req[l]){ is=0; } } if(is==1){ mn=min((j-i)+1,mn); //cout <<i<<' '<<j<<endl; } } } if(mn==999999){ cout <<"IMPOSSIBLE"<<endl; } else{ cout <<mn<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...