Submission #741518

#TimeUsernameProblemLanguageResultExecution timeMemory
741518veehjLottery (CEOI18_lot)C++17
25 / 100
3050 ms65536 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define F first #define S second #define pb push_back #define sz(a) (int)a.size() #define pll pair<ll, ll> #define all(x) (x).begin(), (x).end() ll l, n; vector<ll> v; vector<vector<ll>> v1; void f(){ for(ll i=0; i<l; i++){ for(ll j=0; j<n-l+1; j++){ for(ll k=j+1; k<n-l+1; k++){ if(v[j+i]!=v[k+i]){ v1[j][k]++; v1[k][j]++; } } } } for(auto& u : v1) sort(all(u)); } int main() { cin >> n >> l; v.resize(n); for(auto& u : v) cin >> u; v1.assign(n-l+1, vector<ll>(n-l+1, 0)); f(); ll q; cin >> q; while(q--){ ll x; cin >> x; for(ll i=0; i<n-l+1; i++){ cout << (upper_bound(all(v1[i]), x)-v1[i].begin())-1 << ' '; } cout << endl; } }
#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...