제출 #473993

#제출 시각아이디문제언어결과실행 시간메모리
473993ZaZo_Lottery (CEOI18_lot)C++14
0 / 100
3 ms460 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; } } if(l==1) ans[0] = arr[0]; cin>>q; int flg=0; for(int i = 0 ; i < q ; i++){ int k; cin>>k; if(k==0 && q==1) { for(int i = 0 ; i < n-l+1 ; i++) { if(ans[i]) ans[i]=mp[ans[i]]-1; cout<<ans[i]<<" "; } cout<<'\n'; } else { 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'; } } }
#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...