제출 #483325

#제출 시각아이디문제언어결과실행 시간메모리
483325MOUF_MAHMALATLottery (CEOI18_lot)C++14
20 / 100
114 ms844 KiB
#include<bits/stdc++.h> #define all(s) s.begin(),s.end() #define F first #define S second using namespace std; typedef int ll; const ll mod=1e9+7; ll n,q,l,a[10000],x,f[10000]; map<ll,ll>mp; int main() { ios_base::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n>>l; f[0]=1; for(ll i=1;i<=n;i++) f[i]=(1LL*f[i-1]*1021)%mod; for(ll i=0;i<n;i++) cin>>a[i]; for(ll i=0;i+l-1<n;i++) { x=0; for(ll j=i;j<i+l;j++) x=(1LL*x+1LL*f[j-i]*a[j])%mod; mp[x]++; a[i]=x; } cin>>q; while(q--) { cin>>x; for(ll i=0;i+l-1<n;i++) cout<<mp[a[i]]-1<<" "; } 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...