# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1086169 |
2024-09-09T16:28:27 Z |
dwuy |
Lottery (CEOI18_lot) |
C++14 |
|
0 ms |
348 KB |
/** - dwuy -
/> フ
| _ _|
/`ミ _x ノ
/ |
/ ヽ ?
/ ̄| | | |
| ( ̄ヽ__ヽ_)_)
\二つ
**/
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"
using namespace std;
typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;
const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 1003;
int n, ln, q;
int a[MX];
int qr[MX];
int id[MX];
int ans[MX][103];
vector<int> rv;
void nhap(){
cin >> n >> ln;
for(int i=1; i<=n; i++) cin >> a[i];
cin >> q;
for(int i=1; i<=q; i++){
cin >> qr[i];
rv.push_back(qr[i]);
}
sort(rv.begin(), rv.end());
rv.erase(unique(rv.begin(), rv.end()), rv.end());
}
void solve(){
for(int i=0; i<len(rv); i++) id[rv[i]] = i + 1;
for(int i=1; i<MX; i++) id[i] = id[i]? id[i] : id[i-1];
for(int i=ln + 1; i<=n; i++){
int cur = 0;
for(int j=1; j<=ln; j++) cur += a[j] != a[i - ln + j];
ans[ln][id[cur]]++;
ans[i][id[cur]]++;
for(int j=i+1; j<=n; j++){
cur += a[j] != a[ln + j - i];
cur -= a[j - ln] != a[j - i];
ans[ln + j - i][id[cur]]++;
ans[j][id[cur]]++;
}
}
for(int i=1; i<103; i++){
for(int j=1; j<=n; j++) ans[j][i] += ans[j][i-1];
}
for(int j=1; j<=q; j++){
for(int i=ln; i<=n; i++) cout << ans[i][qr[j]] << ' ';
cout << endl;
}
}
int32_t main(){
fastIO;
//file(TASK);
nhap();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
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 |
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 |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |