Submission #396701

#TimeUsernameProblemLanguageResultExecution timeMemory
396701abdzagLottery (CEOI18_lot)C++17
0 / 100
250 ms676 KiB
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=int(a);i<int(b);i++) #define rrep(i,a,b) for(int i=int(a);i>int(b); i--); #define all(v) v.begin(),v.end() #define trav(a,v) for(auto&a:v) using namespace std; const long long inf = 1e15; typedef long long ll; int main(){ cin.sync_with_stdio(false); ll n,L; cin >> n >> L; vector<ll> v(n); rep(i, 0, n) cin >> v[i]; vector<ll> powers(1e4 + 1); powers[0] = 1; rep(i, 1, 1e4 + 1) { powers[i] = 47 * powers[i - 1]; } vector<ll> intervals(n + 1); rep(i, 0, n-L+1) { ll curval = 0; rep(j, 0, L) { curval += powers[j] * v[i+j]; } intervals[i] = curval; } ll q; cin >> q; rep(o, 0, q) { ll k; cin >> k; rep(i, 0, n - L + 1) { ll l = i, r = i + L; ll ans = 0; rep(j, 0, n - L + 1) { if (j == i)continue; if (intervals[i]==intervals[j])ans++; } cout << ans << " "; } cout << endl; } return 0; }

Compilation message (stderr)

lot.cpp: In function 'int main()':
lot.cpp:38:7: warning: unused variable 'l' [-Wunused-variable]
   38 |    ll l = i, r = i + L;
      |       ^
lot.cpp:38:14: warning: unused variable 'r' [-Wunused-variable]
   38 |    ll l = i, r = i + L;
      |              ^
#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...