# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068714 | 2024-08-21T11:29:34 Z | PotatoTheWarriorFRTT | Lottery (CEOI18_lot) | C++14 | 104 ms | 1380 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll p1 = 27644437; ll p2 = 1000000007; // ll power(ll x, ll y) { // y = y%MOD; // x = x%MOD; // ll res = 1; // while(y != 0) { // if(y%2) { // res = (res*x)%MOD; // } // x = (x*x)%MOD; // y/=2; // } // return res; // } void solve() { int n, l; cin >> n >> l; int a[n+1]; set<ll> s; map<ll, vector<int>> mape; for(int i=0;i<n;i++) { int x; cin >> x; s.insert(x); mape[x].push_back(i); } int k = 0; for(ll l: s) { for(int i=0;i<mape[l].size();i++) { a[mape[l][i]] = k; } k++; } ll powers[l+1]; powers[0] = 1; for(int i=0;i<l-1;i++) { powers[i+1] = (powers[i] * p1)%p2; } unordered_map<ll, ll> m; ll hashes[n+1]; for(int i=0;i<n-l+1;i++) { ll hash = 0; for(int j=0;j<l;j++) { hash = (hash + (a[i+j] * powers[j]))%p2; } hashes[i] = hash; m[hash]++; } int q; cin >> q; int ki; cin >> ki; // q=0;k=1; for(int i=0;i<n-l+1;i++) { cout << m[hashes[i]]-1 << " "; } cout << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); // int t; cin >> t; // while(t--) solve(); char dksfjn; cin >> dksfjn; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 604 KB | Output is correct |
2 | Correct | 2 ms | 604 KB | Output is correct |
3 | Correct | 2 ms | 604 KB | Output is correct |
4 | Correct | 12 ms | 860 KB | Output is correct |
5 | Correct | 100 ms | 852 KB | Output is correct |
6 | Correct | 30 ms | 860 KB | Output is correct |
7 | Correct | 92 ms | 604 KB | Output is correct |
8 | Correct | 80 ms | 600 KB | Output is correct |
9 | Correct | 14 ms | 600 KB | Output is correct |
10 | Correct | 9 ms | 600 KB | Output is correct |
11 | Correct | 10 ms | 856 KB | Output is correct |
12 | Correct | 66 ms | 1380 KB | Output is correct |
13 | Correct | 104 ms | 1144 KB | Output is correct |
14 | Correct | 100 ms | 1044 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 604 KB | Output is correct |
2 | Correct | 2 ms | 604 KB | Output is correct |
3 | Correct | 2 ms | 604 KB | Output is correct |
4 | Correct | 12 ms | 860 KB | Output is correct |
5 | Correct | 100 ms | 852 KB | Output is correct |
6 | Correct | 30 ms | 860 KB | Output is correct |
7 | Correct | 92 ms | 604 KB | Output is correct |
8 | Correct | 80 ms | 600 KB | Output is correct |
9 | Correct | 14 ms | 600 KB | Output is correct |
10 | Correct | 9 ms | 600 KB | Output is correct |
11 | Correct | 10 ms | 856 KB | Output is correct |
12 | Correct | 66 ms | 1380 KB | Output is correct |
13 | Correct | 104 ms | 1144 KB | Output is correct |
14 | Correct | 100 ms | 1044 KB | Output is correct |
15 | Incorrect | 16 ms | 1016 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |