제출 #362856

#제출 시각아이디문제언어결과실행 시간메모리
362856NimbostratusLottery (CEOI18_lot)C++17
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; #define eb emplace_back #define pb push_back #define ppb pop_back #define ub upper_bound #define lb lower_bound #define bs binary_search #define cl(a,s) memset((a),0,sizeof((a)[0])*(s)) #define all(x) (x).begin() , (x).end() #define fi first #define se second #define int int using pii = pair<int,int>; using ll = long long; const int maxn = 305; const int maxq = 105; const int inf = 1e9; const int mod = 1e9+7; int n,a[maxn],l,q; int ans[maxn][maxq]; int k[maxq]; int dist(int ind1 ,int ind2) { int cnt = 0; for(int i=ind1;i<=ind1+l-1;i++) if(a[i] != a[ind2+i-ind1]) cnt++; return cnt; } int32_t main () { //freopen("in","r",stdin); freopen("out","w",stdout); ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> n >> l; for(int i=1;i<=n;i++) cin >> a[i]; cin >> q; for(int i=1;i<=q;i++) cin >> k[i]; sort(k+1,k+q+1); for(int i=1;i+l-1<=n;i++) for(int j=i+1;j+l-1<=n;j++) { int res = dist(i,j); for(int m=q;res<=k[m] and m>=1;m--) { ans[i][m]++; ans[j][m]++; } } for(int i=1;i<=q;i++,cout << endl) for(int j=1;j+l-1<=n;j++) cout << ans[j][i] << " "; }
#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...