제출 #483330

#제출 시각아이디문제언어결과실행 시간메모리
483330MOUF_MAHMALATLottery (CEOI18_lot)C++14
45 / 100
3090 ms628 KiB
#include<bits/stdc++.h> #define all(s) s.begin(),s.end() #define F first #define S second using namespace std; typedef int ll; ll n,l,q,o,a[10001],c[10001],x,ans; map<ll,ll>mp; vector<vector<ll> >v; int main() { ios_base::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n>>l; for(ll i=0; i<n; i++) { cin>>a[i]; if(!mp[a[i]]) mp[a[i]]=++o; a[i]=mp[a[i]]; } mp.clear(); v.resize(o+1); for(ll i=0; i<n; i++) v[a[i]].push_back(i); cin>>q; while(q--) { cin>>x; x=l-x; for(ll i=0; i+l-1<n; i++) { ans=0; memset(c,0,sizeof c); for(ll j=i; j<i+l; j++) { for(auto k:v[a[j]]) { if(k-j+i>=0) c[k-j+i]++; } } for(ll j=0; j+l-1<n; j++) if(i!=j) ans+=(c[j]>=x); cout<<ans<<" "; } cout<<endl; } return 0; }
#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...