제출 #443315

#제출 시각아이디문제언어결과실행 시간메모리
443315Haruto810198Lottery (CEOI18_lot)C++17
45 / 100
648 ms15952 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define double long double #define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d)) #define szof(x) ((int)(x).size()) #define vi vector<int> #define pii pair<int, int> #define F first #define S second #define pb push_back #define eb emplace_back #define mkp make_pair //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") const int INF = 2147483647; //const int LNF = INF*INF; const int MOD = 1000000007; const int mod = 998244353; const double eps = 1e-12; const int MAX = 2010; int n, len; int arr[MAX]; int q; int dif[MAX][MAX]; int res[MAX]; void get_dif(int u, int v){ int cnt = 0; FOR(i, 0, len-1, 1){ if(arr[u+i] != arr[v+i]){ cnt++; } } dif[u][v] = dif[v][u] = cnt; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>len; FOR(i, 0, n-1, 1){ cin>>arr[i]; } FOR(i, 0, n-len, 1){ FOR(j, i+1, n-len, 1){ get_dif(i, j); } } cin>>q; while(q--){ int req; cin>>req; FOR(i, 0, n-len, 1){ res[i] = -1; FOR(j, 0, n-len, 1){ if(dif[i][j] <= req){ res[i]++; } } cout<<res[i]<<" "; } cout<<'\n'; } 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...