# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
868113 |
2023-10-30T12:49:01 Z |
Cookie |
Lottery (CEOI18_lot) |
C++14 |
|
242 ms |
28500 KB |
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
ifstream fin("HCN.INP");
ofstream fout("HCN.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;
//using u128 = __uint128_t;
//const int x[4] = {1, -1, 0, 0};
//const int y[4] = {0, 0, 1, -1};
const ll mod = 1e9 + 9;
const int mxn = 1e5 + 5, mxq = 2e5 + 5, sq = 200, mxv = 2e6 + 5;
const ll inf = 1e17 + 5;
//const int base= (1 << 18);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, l;
int a[2005], pref[4005][2005];
int get(int diag, int l, int r){
return(pref[diag][r] - pref[diag][l - 1]);
}
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> l;
for(int i = 1; i <= n; i++)cin >> a[i];
for(int i = 1; i <= n + n - 1; i++){
for(int row = 1; row <= n; row++){
int col = i - n + row;
if(col <= 0 || col > n)continue;
pref[i][row] = pref[i][row - 1] + (a[row] != a[col]);
}
}
int q; cin >> q;
while(q--){
int k; cin >> k;
for(int i = 1; i + l - 1 <= n; i++){
int cnt = 0;
for(int j = 1; j + l - 1 <= n; j++){
if(i != j)cnt += (get(j - i + n, i, i + l - 1) <= k);
}
cout << cnt << " ";
}
cout << "\n";
}
return(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
3164 KB |
Output is correct |
9 |
Correct |
3 ms |
3164 KB |
Output is correct |
10 |
Correct |
5 ms |
3416 KB |
Output is correct |
11 |
Correct |
5 ms |
3164 KB |
Output is correct |
12 |
Correct |
7 ms |
3164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
3164 KB |
Output is correct |
9 |
Correct |
3 ms |
3164 KB |
Output is correct |
10 |
Correct |
5 ms |
3416 KB |
Output is correct |
11 |
Correct |
5 ms |
3164 KB |
Output is correct |
12 |
Correct |
7 ms |
3164 KB |
Output is correct |
13 |
Correct |
105 ms |
28440 KB |
Output is correct |
14 |
Correct |
194 ms |
28456 KB |
Output is correct |
15 |
Correct |
69 ms |
28252 KB |
Output is correct |
16 |
Correct |
242 ms |
28500 KB |
Output is correct |
17 |
Correct |
201 ms |
28436 KB |
Output is correct |
18 |
Correct |
202 ms |
28436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1116 KB |
Output is correct |
3 |
Correct |
1 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
1 ms |
1116 KB |
Output is correct |
6 |
Correct |
1 ms |
1116 KB |
Output is correct |
7 |
Correct |
1 ms |
1116 KB |
Output is correct |
8 |
Correct |
3 ms |
3164 KB |
Output is correct |
9 |
Correct |
3 ms |
3164 KB |
Output is correct |
10 |
Correct |
5 ms |
3416 KB |
Output is correct |
11 |
Correct |
5 ms |
3164 KB |
Output is correct |
12 |
Correct |
7 ms |
3164 KB |
Output is correct |
13 |
Correct |
105 ms |
28440 KB |
Output is correct |
14 |
Correct |
194 ms |
28456 KB |
Output is correct |
15 |
Correct |
69 ms |
28252 KB |
Output is correct |
16 |
Correct |
242 ms |
28500 KB |
Output is correct |
17 |
Correct |
201 ms |
28436 KB |
Output is correct |
18 |
Correct |
202 ms |
28436 KB |
Output is correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |