# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396737 | danielcm585 | Martian DNA (BOI18_dna) | C++14 | 63 ms | 2460 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> ii;
const int N = 2e5;
int n, k, r;
int a[N+2], cnt[N+2], need[N+2];
bool can(int mid) {
memset(cnt,0,sizeof(cnt));
int get = 0;
for (int i = 1; i <= n; i++) {
cnt[a[i]]++;
get += (need[a[i]] && cnt[a[i]] == need[a[i]]);
if (i-mid >= 1) {
get -= (need[a[i-mid]] && cnt[a[i-mid]] == need[a[i-mid]]);
cnt[a[i-mid]]--;
}
if (i >= mid && get == r) return 1;
}
return 0;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
# | 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... |