Submission #458057

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4580572021-08-07 23:44:49JovanB Martian DNA (BOI18_dna)C++17
100 / 100
71 ms4456 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n, k, R;
int niz[200005];
int treba[200005];
int br[200005];
bool check(int x){
for(int i=1; i<=k; i++){
br[i] = 0;
}
int cnt = 0;
for(int i=1; i<=x; i++){
br[niz[i]]++;
if(br[niz[i]] == treba[niz[i]]) cnt++;
}
if(cnt >= R) return 1;
for(int i=x+1; i<=n; i++){
br[niz[i]]++;
if(br[niz[i]] == treba[niz[i]]) cnt++;
br[niz[i-x]]--;
if(br[niz[i-x]] == treba[niz[i-x]]-1) cnt--;
if(cnt >= R) return 1;
}
return 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...