제출 #473986

#제출 시각아이디문제언어결과실행 시간메모리
473986ZaZo_Lottery (CEOI18_lot)C++14
45 / 100
696 ms31764 KiB
#include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long const int N = 2010; using namespace std; int n , l ,q; int v[N][N]; int ans[10005]={0},arr[10005]; int32_t main() { ZAZO cin >> n >> l ; map<int,int>mp; int cnt=1 , first=0; for(int i = 0 ; i < n ; i ++) { cin >> arr[i]; if(i && arr[i] == arr[i-1]) { cnt++; if(cnt >= l) { first = i-(l-1); ans[first] = arr[i]; mp[arr[i]]++; } } else { cnt=1; } } cin>>q; int flg=0; while(q--){ int k; cin>>k; if(n<=2000 || k!=1) { if(!flg) { flg=1; for(int i = 0 ; i < n-l+1 ; i ++) { for(int j = i+1 ; j < n-l+1 ; j ++) { int cur=0; for(int p = 0 ; p < l ; p ++) if(arr[i+p] != arr[j+p] ) cur++; v[i][j]=v[j][i]=cur; } } } for(int i = 0 ; i < n-l+1 ; i ++) { ans[i]=-1; for(int j = 0 ; j < n-l+1 ; j++) { if(v[i][j]<=k) ans[i]++; } cout<<ans[i]<<" "; } cout<<'\n'; } else { for(int i = 0 ; i < n ; i++) { if(ans[i]) ans[i]=mp[ans[i]]-1; cout<<ans[i]<<" "; } 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...