제출 #417212

#제출 시각아이디문제언어결과실행 시간메모리
417212egekabasLottery (CEOI18_lot)C++14
45 / 100
159 ms65540 KiB
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; int n, l, q; int a[10009]; int ans[109][10009]; int k[109]; vector<int> st[10009]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); cin >> n >> l; vector<int> mpp; for(int i = 0; i < n; ++i) cin >> a[i]; for(int dis = 1; dis < n; ++dis){ vector<int> pre(n); for(int i = 0; i+dis < n; ++i) if(a[i] == a[i+dis]){ pre[max(0, i-l+1)]++; pre[i+1]--; } for(int i = 0; i < n; ++i){ if(i) pre[i] += pre[i-1]; if(i+dis+l <= n){ st[i].pb(l-pre[i]); st[i+dis].pb(l-pre[i]); } } } for(int i = 0; i < n; ++i) sort(all(st[i])); cin >> q; for(int i = 0; i < q; ++i){ cin >> k[i]; for(ll j = 0; j+l <= n; ++j) cout << (upper_bound(all(st[j]), k[i])-st[j].begin()) << ' '; cout << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...