# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
396695 |
2021-04-30T15:40:54 Z |
abdzag |
Lottery (CEOI18_lot) |
C++17 |
|
231 ms |
676 KB |
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b); i--);
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
using namespace std;
const long long inf = 1e15;
typedef long long ll;
int main(){
cin.sync_with_stdio(false);
ll n,L;
cin >> n >> L;
vector<ll> v(n);
rep(i, 0, n) cin >> v[i];
vector<ll> powers(1e4 + 1);
powers[0] = 1;
rep(i, 1, 1e4 + 1) {
powers[i] = 31 * powers[i - 1];
}
vector<ll> intervals(n + 1);
rep(i, 0, n-L+1) {
ll curval = 0;
rep(j, 0, L) {
curval += powers[j] * v[i+j];
}
intervals[i] = curval;
}
ll q;
cin >> q;
rep(o, 0, q) {
ll k;
cin >> k;
rep(i, 0, n - L + 1) {
ll l = i, r = i + L;
ll ans = 0;
rep(j, 0, n - L + 1) {
if (j == i)continue;
if (intervals[i]==intervals[j])ans++;
}
cout << ans << " ";
}
cout << endl;
}
return 0;
}
Compilation message
lot.cpp: In function 'int main()':
lot.cpp:38:7: warning: unused variable 'l' [-Wunused-variable]
38 | ll l = i, r = i + L;
| ^
lot.cpp:38:14: warning: unused variable 'r' [-Wunused-variable]
38 | ll l = i, r = i + L;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
231 ms |
560 KB |
Output is correct |
2 |
Correct |
119 ms |
544 KB |
Output is correct |
3 |
Correct |
98 ms |
544 KB |
Output is correct |
4 |
Correct |
98 ms |
676 KB |
Output is correct |
5 |
Correct |
55 ms |
652 KB |
Output is correct |
6 |
Correct |
89 ms |
644 KB |
Output is correct |
7 |
Correct |
33 ms |
652 KB |
Output is correct |
8 |
Correct |
44 ms |
664 KB |
Output is correct |
9 |
Correct |
114 ms |
588 KB |
Output is correct |
10 |
Correct |
130 ms |
652 KB |
Output is correct |
11 |
Incorrect |
6 ms |
452 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
231 ms |
560 KB |
Output is correct |
2 |
Correct |
119 ms |
544 KB |
Output is correct |
3 |
Correct |
98 ms |
544 KB |
Output is correct |
4 |
Correct |
98 ms |
676 KB |
Output is correct |
5 |
Correct |
55 ms |
652 KB |
Output is correct |
6 |
Correct |
89 ms |
644 KB |
Output is correct |
7 |
Correct |
33 ms |
652 KB |
Output is correct |
8 |
Correct |
44 ms |
664 KB |
Output is correct |
9 |
Correct |
114 ms |
588 KB |
Output is correct |
10 |
Correct |
130 ms |
652 KB |
Output is correct |
11 |
Incorrect |
6 ms |
452 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |