Submission #930476

# Submission time Handle Problem Language Result Execution time Memory
930476 2024-02-20T01:44:04 Z Regulus Lottery (CEOI18_lot) C++17
0 / 100
5 ms 1124 KB
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define bug(x) cerr << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
//#define TEST

const int N = 10005;
const int MOD = 19993;
const int MOD2 = 1e9+7;
ll a[N], sum[N], p[N];
map<ll, int> mp;

int main(void)
{ IO
    int n, i, Q, len;

    cin >> n >> len;
    for (i=1; i <= n; ++i) cin >> a[i];
    cin >> Q; if (Q != 1) assert(0);
    cin >> i; if (i != 0) assert(0);

    for (i=1, p[0]=1; i <= n; ++i) p[i] = p[i-1] * MOD % MOD2;
    for (i=1; i <= n; ++i) sum[i] = (sum[i-1]*MOD % MOD2 + a[i]) % MOD2;
    for (i=len; i <= n; ++i)
    {
        ll tmp = (sum[i] - sum[i-len]*p[len]%MOD2 + MOD2) % MOD2;
        ++mp[tmp];
    }

    for (i=len; i <= n; ++i)
    {
        ll tmp = (sum[i] - sum[i-len]*p[len]%MOD2 + MOD2) % MOD2;
        cout << mp[tmp] - 1 << ' ';
    }
    cout << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 1 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 1 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 856 KB Output is correct
5 Correct 4 ms 1116 KB Output is correct
6 Correct 5 ms 1116 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 804 KB Output is correct
9 Correct 3 ms 624 KB Output is correct
10 Correct 3 ms 836 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Incorrect 4 ms 1124 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 856 KB Output is correct
5 Correct 4 ms 1116 KB Output is correct
6 Correct 5 ms 1116 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 804 KB Output is correct
9 Correct 3 ms 624 KB Output is correct
10 Correct 3 ms 836 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Incorrect 4 ms 1124 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 1 ms 600 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -