제출 #1128890

#제출 시각아이디문제언어결과실행 시간메모리
1128890HossamHero7Lottery (CEOI18_lot)C++20
45 / 100
832 ms131072 KiB
// In sha2 Allah IOI 2025 #include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' void solve(){ int n,l; cin>>n>>l; vector<int> a(n); for(auto &i:a) cin>>i; vector<vector<int>> v(n+1); for(int i=0;i<n-l+1;i++){ for(int j=0;j<n-l+1;j++){ if(i == j) continue; int cnt = 0; for(int k=0;k<l;k++){ if(a[i+k] != a[j+k]) cnt ++; } v[i].push_back(cnt); } sort(v[i].begin(),v[i].end()); } int q; cin>>q; while(q--){ int x; cin>>x; for(int i=0;i<n-l+1;i++){ int idx = upper_bound(v[i].begin(),v[i].end(),x) - v[i].begin(); cout<<idx<<' '; } cout<<endl; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--){ solve(); } 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...