# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
891062 | Hhw48 | Martian DNA (BOI18_dna) | C++14 | 2077 ms | 5308 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,k,r;
cin>>n>>k>>r;
string s="";
int tmp=0,tmp2=0;
for(int i=0; i<n; i++){
char x;
cin>>x;
s += x;
}
multiset<int>mset;
unordered_set <int> uset;
vector<pii>vec;
for(int i=0; i<r; i++){
int a,b;
cin>>a>>b;
vec.pb({a,b});
tmp += b;
uset.insert(a);
}
for(int i=0; i<n; i++){
if(uset.count(s[i]-'0')==1){
tmp2++;
}
}
if(tmp2<tmp){
cout<<"impossible";
return 0;
}
for(int i=tmp; i<n; i++){
for(int x=0; x<n-i; x++){
int idx=x;
while(idx<x+i){
if(uset.count(s[idx]-'0')==1){
mset.insert(s[idx]-'0');
}
idx++;
}
bool flag=false;
for(int j=0; j<r; j++){
if(mset.count(vec[j].fi)<vec[j].se)flag=true;
}
if(flag==0){
cout<<i;
exit(0);
}
flag=false;
mset.clear();
}
}
cout<<"impossible";
}
컴파일 시 표준 에러 (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... |