QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#214103 | #6548. Courses | ucup-team087# | AC ✓ | 2574ms | 46176kb | C++14 | 12.5kb | 2023-10-14 17:13:26 | 2023-10-14 17:13:26 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0U) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModInt inv() const {
unsigned a = M, b = x; int y = 0, z = 1;
for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
assert(a == 1U); return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
constexpr unsigned MO = 998244353U;
constexpr unsigned MO2 = 2U * MO;
constexpr int FFT_MAX = 23;
using Mint = ModInt<MO>;
constexpr Mint FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 911660635U, 372528824U, 929031873U, 452798380U, 922799308U, 781712469U, 476477967U, 166035806U, 258648936U, 584193783U, 63912897U, 350007156U, 666702199U, 968855178U, 629671588U, 24514907U, 996173970U, 363395222U, 565042129U, 733596141U, 267099868U, 15311432U};
constexpr Mint INV_FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 86583718U, 509520358U, 337190230U, 87557064U, 609441965U, 135236158U, 304459705U, 685443576U, 381598368U, 335559352U, 129292727U, 358024708U, 814576206U, 708402881U, 283043518U, 3707709U, 121392023U, 704923114U, 950391366U, 428961804U, 382752275U, 469870224U};
constexpr Mint FFT_RATIOS[FFT_MAX] = {911660635U, 509520358U, 369330050U, 332049552U, 983190778U, 123842337U, 238493703U, 975955924U, 603855026U, 856644456U, 131300601U, 842657263U, 730768835U, 942482514U, 806263778U, 151565301U, 510815449U, 503497456U, 743006876U, 741047443U, 56250497U, 867605899U};
constexpr Mint INV_FFT_RATIOS[FFT_MAX] = {86583718U, 372528824U, 373294451U, 645684063U, 112220581U, 692852209U, 155456985U, 797128860U, 90816748U, 860285882U, 927414960U, 354738543U, 109331171U, 293255632U, 535113200U, 308540755U, 121186627U, 608385704U, 438932459U, 359477183U, 824071951U, 103369235U};
// as[rev(i)] <- \sum_j \zeta^(ij) as[j]
void fft(Mint *as, int n) {
assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
int m = n;
if (m >>= 1) {
for (int i = 0; i < m; ++i) {
const unsigned x = as[i + m].x; // < MO
as[i + m].x = as[i].x + MO - x; // < 2 MO
as[i].x += x; // < 2 MO
}
}
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i + m].x = as[i].x + MO - x; // < 3 MO
as[i].x += x; // < 3 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
for (; m; ) {
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i + m].x = as[i].x + MO - x; // < 4 MO
as[i].x += x; // < 4 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i + m].x = as[i].x + MO - x; // < 3 MO
as[i].x += x; // < 3 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
}
for (int i = 0; i < n; ++i) {
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i].x = (as[i].x >= MO) ? (as[i].x - MO) : as[i].x; // < MO
}
}
// as[i] <- (1/n) \sum_j \zeta^(-ij) as[rev(j)]
void invFft(Mint *as, int n) {
assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
int m = 1;
if (m < n >> 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned long long y = as[i].x + MO - as[i + m].x; // < 2 MO
as[i].x += as[i + m].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
}
m <<= 1;
}
for (; m < n >> 1; m <<= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + (m >> 1); ++i) {
const unsigned long long y = as[i].x + MO2 - as[i + m].x; // < 4 MO
as[i].x += as[i + m].x; // < 4 MO
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
for (int i = i0 + (m >> 1); i < i0 + m; ++i) {
const unsigned long long y = as[i].x + MO - as[i + m].x; // < 2 MO
as[i].x += as[i + m].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
}
}
if (m < n) {
for (int i = 0; i < m; ++i) {
const unsigned y = as[i].x + MO2 - as[i + m].x; // < 4 MO
as[i].x += as[i + m].x; // < 4 MO
as[i + m].x = y; // < 4 MO
}
}
const Mint invN = Mint(n).inv();
for (int i = 0; i < n; ++i) {
as[i] *= invN;
}
}
void fft(vector<Mint> &as) {
fft(as.data(), as.size());
}
void invFft(vector<Mint> &as) {
invFft(as.data(), as.size());
}
vector<Mint> convolve(vector<Mint> as, vector<Mint> bs) {
if (as.empty() || bs.empty()) return {};
const int len = as.size() + bs.size() - 1;
int n = 1;
for (; n < len; n <<= 1) {}
as.resize(n); fft(as);
bs.resize(n); fft(bs);
for (int i = 0; i < n; ++i) as[i] *= bs[i];
invFft(as);
as.resize(len);
return as;
}
vector<Mint> square(vector<Mint> as) {
if (as.empty()) return {};
const int len = as.size() + as.size() - 1;
int n = 1;
for (; n < len; n <<= 1) {}
as.resize(n); fft(as);
for (int i = 0; i < n; ++i) as[i] *= as[i];
invFft(as);
as.resize(len);
return as;
}
////////////////////////////////////////////////////////////////////////////////
#ifdef LOCAL
constexpr int B = 3;
#else
constexpr int B = 200;
#endif
constexpr int V = 9;
int M;
int C[110], D[110];
Mint W[110];
int N, K;
vector<Mint> baby[B + 1][V][V];
int main() {
for (; ~scanf("%d", &M); ) {
for (int m = 0; m < M; ++m) {
scanf("%d%d%u", &C[m], &D[m], &W[m].x);
}
scanf("%d%d", &N, &K);
for (int n = 0; n <= B; ++n) {
const int off = n + (V - 1);
for (int u = 0; u < V; ++u) for (int v = 0; v < V; ++v) {
baby[n][u][v].assign(off + 1 + off, 0);
}
}
for (int u = 0; u < V; ++u) {
baby[0][u][u][V - 1] += 1;
}
for (int u = 0; u < V - 1; ++u) {
baby[1][u][u + 1][V] += 1;
}
for (int m = 0; m < M; ++m) {
baby[1][C[m] - 1][0][V + D[m]] += W[m];
}
for (int n = 2; n <= B; ++n) {
const int off = n + (V - 1);
const int off1 = (n - 1) + (V - 1);
for (int u = 0; u < V; ++u) for (int v = 0; v < V; ++v) for (int w = 0; w < V; ++w) if (v + 1 == w || w == 0) {
for (int l = -V; l <= V; ++l) if (baby[1][v][w][V + l]) {
for (int k = -off1; k <= off1; ++k) if (baby[n - 1][u][v][off1 + k]) {
baby[n][u][w][off + (k + l)] += baby[n - 1][u][v][off1 + k] * baby[1][v][w][V + l];
}
}
}
}
// for(int n=0;n<=B;++n){cerr<<n<<": "<<baby[n][0][0]<<endl;}
const int lim = (N/B) * (B + (V - 1));
int len = 1;
for (; len < lim + 1 + lim; len <<= 1) {}
vector<Mint> fss[V][V], gss[V], hss[V], tail[V];
for (int u = 0; u < V; ++u) for (int v = 0; v < V; ++v) {
fss[u][v] = baby[B][u][v];
fss[u][v].resize(len, 0);
fft(fss[u][v]);
}
for (int u = 0; u < V; ++u) {
gss[u].assign(len, (u == 0) ? 1 : 0);
hss[u].assign(len, 0);
tail[u].assign(len + 1, 0);
tail[u][0] = (u == 0) ? 1 : 0;
}
vector<Mint> ans(N + 1, 0);
for (int q = 0; q <= N; q += B) {
const int offQ = (q/B) * (B + (V - 1));
for (int r = 0; r < B && q + r <= N; ++r) {
const int offR = r + (V - 1);
for (int u = 0; u < V; ++u) for (int k = -offR; k <= +offR; ++k) {
ans[q + r] += tail[u][min(max(offQ + (K - k), 0), len)] * baby[r][u][0][offR + k];
}
}
for (int u = 0; u < V; ++u) {
fill(hss[u].begin(), hss[u].end(), 0);
}
for (int u = 0; u < V; ++u) for (int v = 0; v < V; ++v) {
for (int i = 0; i < len; ++i) {
hss[v][i] += gss[u][i] * fss[u][v][i];
}
}
for (int u = 0; u < V; ++u) {
copy(hss[u].begin(), hss[u].end(), gss[u].begin());
invFft(hss[u]);
for (int i = len; --i >= 0; ) {
tail[u][i] = hss[u][i] + tail[u][i + 1];
}
}
}
for (int n = 1; n <= N; ++n) {
printf("%u\n", ans[n].x);
}
#ifdef LOCAL
vector<map<int,Mint>>dp(N+1);
dp[0][0]=1;
for(int n=0;n<=N;++n)for(const auto&kv:dp[n]){
for(int m=0;m<M;++m){
const int nn=n+C[m];
if(nn<=N)dp[nn][kv.first+D[m]]+=kv.second*W[m];
}
}
vector<Mint>brt(N+1,0);
for(int n=0;n<=N;++n)for(const auto&kv:dp[n]){
if(kv.first>=K)brt[n]+=kv.second;
}
if(brt!=ans){
cerr<<"brt = "<<brt<<endl;
cerr<<"ans = "<<ans<<endl;
for(int n=0;n<=N;++n){cerr<<"dp["<<n<<"] = ";pv(dp[n].begin(),dp[n].end());}
}
assert(brt==ans);
#endif
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 18680kb
input:
1 1 1 2 5 2
output:
0 4 8 16 32
result:
ok 5 number(s): "0 4 8 16 32"
Test #2:
score: 0
Accepted
time: 0ms
memory: 18684kb
input:
2 1 -1 1 1 1 2 4 2
output:
0 4 8 48
result:
ok 4 number(s): "0 4 8 48"
Test #3:
score: 0
Accepted
time: 66ms
memory: 18396kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
6625 87655919 636581604 585696387 17620788 88066998 904901665 846840737 360330214 620333919 136263062 39075213 241172245 519044851 379562425 532682226 777144743 462280426 307921116 700072043 707231396 323401925 598314068 841884023 28387679 166454723 975772805 448135193 488726970 475593671 612544405 ...
result:
ok 50 numbers
Test #4:
score: 0
Accepted
time: 59ms
memory: 18472kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 222482394 102292681 565355160 333486463 886638230 52090154 281012452 952479247 304932178 295271280 465504333 532380933 466697686 81655090 222769990 649695168 965196638 449484395 193519633 531647625 825384784 972338190 400630002 67150012...
result:
ok 131 numbers
Test #5:
score: 0
Accepted
time: 59ms
memory: 18588kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 9347849 942974795 318066180 278731032 587652157 434259249 126876923 16289901 123413264 719603917 254105333 15119937 24263100 889628559 948576022 694493917 964003437 228253365 52984044 254401943 310992697 233279578 253910650 898447558 524407420 957548516 901926896 2245698 91236941 8...
result:
ok 228 numbers
Test #6:
score: 0
Accepted
time: 59ms
memory: 18696kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 0 0 823233314 56884775 409561125 803981488 839767063 890265463 385665407 24390958 244235164 479515345 412009151 206386153 128897565 962065073 224758497 357196269 984807250 576030233 223162017 716194180 565496686 166080856 37562000 597023700 855251872 854857206 890776034 760485373 6...
result:
ok 60 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 18688kb
input:
1 1 1 1 1 0
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 2562ms
memory: 45888kb
input:
99 1 -1 41 1 0 8467 1 1 6334 2 -2 10000 2 -1 9169 2 0 5724 2 1 1478 2 2 9358 3 -3 0 3 -2 4464 3 -1 5705 3 0 8145 3 1 3281 3 2 6827 3 3 9961 4 -4 491 4 -3 2995 4 -2 1942 4 -1 4827 4 0 5436 4 1 2391 4 2 4604 4 3 3902 4 4 153 5 -5 292 5 -4 2382 5 -3 7421 5 -2 8716 5 -1 9718 5 0 9895 5 1 5447 5 2 1726 5...
output:
14801 219605549 918066257 950671703 802417909 12689425 651470453 668728795 716248950 629320552 39202969 834545918 227150851 737151164 699962737 848039906 604466885 101476713 871998375 232547830 87732586 709395837 157267428 361236765 912370001 804578386 429235235 173468017 920593010 313629484 5617529...
result:
ok 30000 numbers
Test #9:
score: 0
Accepted
time: 2559ms
memory: 45892kb
input:
99 1 -1 6541 1 0 4833 1 1 1115 2 -2 4639 2 -1 9658 2 0 2704 2 1 9930 2 2 3977 3 -3 2306 3 -2 1673 3 -1 2386 3 0 5021 3 1 8745 3 2 6924 3 3 9072 4 -4 6270 4 -3 5829 4 -2 6777 4 -1 5573 4 0 5097 4 1 6512 4 2 3986 4 3 3290 4 4 9161 5 -5 8636 5 -4 2355 5 -3 4767 5 -2 3655 5 -1 5574 5 0 4031 5 1 2052 5 2...
output:
12489 156006029 172365264 222074615 800372787 922955199 527126241 767348550 75160194 135901239 786397568 386475566 18834135 418363890 718680334 385311091 708403725 5329556 437092399 370602391 402897512 463572992 873474889 902787434 201212747 158768241 296664479 513077561 722474520 149862063 61342114...
result:
ok 30000 numbers
Test #10:
score: 0
Accepted
time: 2554ms
memory: 45900kb
input:
99 1 -1 2813 1 0 9514 1 1 4309 2 -2 7616 2 -1 8935 2 0 7451 2 1 600 2 2 5249 3 -3 6519 3 -2 1556 3 -1 2798 3 0 303 3 1 6224 3 2 1008 3 3 5844 4 -4 2609 4 -3 4989 4 -2 2702 4 -1 3195 4 0 485 4 1 3093 4 2 4343 4 3 523 4 4 1587 5 -5 9314 5 -4 9503 5 -3 7448 5 -2 5200 5 -1 3458 5 0 6618 5 1 580 5 2 9796...
output:
16636 276786347 213093791 546823887 31796708 208723341 35285279 679656212 459998578 207814458 133040884 495913022 688862910 794939735 478776133 366117249 817609027 240203216 436688061 926254959 677536480 617748132 592828544 294058028 136330011 459248864 762961915 763444812 365878600 268086280 486254...
result:
ok 30000 numbers
Test #11:
score: 0
Accepted
time: 2567ms
memory: 45980kb
input:
99 1 -1 2154 1 0 5721 1 1 7189 2 -2 9976 2 -1 1329 2 0 2368 2 1 8692 2 2 1425 3 -3 555 3 -2 3434 3 -1 6549 3 0 7441 3 1 9512 3 2 145 3 3 8060 4 -4 1718 4 -3 3753 4 -2 6139 4 -1 2423 4 0 6279 4 1 5996 4 2 6687 4 3 2529 4 4 2549 5 -5 7437 5 -4 9866 5 -3 2949 5 -2 193 5 -1 3195 5 0 3297 5 1 416 5 2 828...
output:
7189 133948376 747955796 731737884 77331863 272865253 466674870 732316155 288724990 600896585 859300478 969350326 974324827 44667439 885092902 215739004 352200494 57045590 673351279 420802217 289546573 10216231 430491015 333742960 193699888 864019581 646717930 755433748 930641036 39879732 637271450 ...
result:
ok 30000 numbers
Test #12:
score: 0
Accepted
time: 2557ms
memory: 46000kb
input:
99 1 -1 7487 1 0 8297 1 1 7518 2 -2 8177 2 -1 7773 2 0 2270 2 1 1763 2 2 2668 3 -3 7192 3 -2 3985 3 -1 3102 3 0 8480 3 1 9213 3 2 7627 3 3 4802 4 -4 4099 4 -3 527 4 -2 2625 4 -1 1543 4 0 1924 4 1 1023 4 2 9972 4 3 3061 4 4 4181 5 -5 1003 5 -4 7432 5 -3 7505 5 -2 7593 5 -1 2725 5 0 3031 5 1 8492 5 2 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #13:
score: 0
Accepted
time: 2569ms
memory: 46004kb
input:
99 1 -1 4596 1 0 3737 1 1 3261 2 -2 195 2 -1 2525 2 0 1264 2 1 8260 2 2 6202 3 -3 8116 3 -2 5030 3 -1 326 3 0 9011 3 1 771 3 2 6411 3 3 5547 4 -4 1153 4 -3 1520 4 -2 9790 4 -1 4924 4 0 188 4 1 1763 4 2 4940 4 3 851 4 4 8662 5 -5 3829 5 -4 900 5 -3 7713 5 -2 8958 5 -1 7578 5 0 8365 5 1 3007 5 2 1477 ...
output:
6998 78962842 201770631 503304665 718862700 247839950 500584818 153909918 166811095 391358471 642541199 742518229 397759650 631887197 490537419 67094197 874735524 922692846 129913392 142031577 718224778 76163465 924853904 179455345 977333137 34695330 10695743 301700576 82110438 492736729 894479113 9...
result:
ok 30000 numbers
Test #14:
score: 0
Accepted
time: 2555ms
memory: 45976kb
input:
99 1 -1 67 1 0 2848 1 1 4675 2 -2 2938 2 -1 2223 2 0 2142 2 1 3754 2 2 6511 3 -3 2741 3 -2 175 3 -1 1459 3 0 7825 3 1 3221 3 2 7870 3 3 1626 4 -4 1934 4 -3 5205 4 -2 1783 4 -1 3850 4 0 7398 4 1 2279 4 2 2701 4 3 2193 4 4 2734 5 -5 1637 5 -4 6534 5 -3 5556 5 -2 1993 5 -1 176 5 0 5705 5 1 6962 5 2 548...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #15:
score: 0
Accepted
time: 2570ms
memory: 46000kb
input:
99 1 -1 8683 1 0 8213 1 1 3992 2 -2 5824 2 -1 5601 2 0 3392 2 1 5759 2 2 2670 3 -3 6428 3 -2 8027 3 -1 4084 3 0 75 3 1 8786 3 2 5498 3 3 4970 4 -4 6287 4 -3 3847 4 -2 2604 4 -1 503 4 0 1221 4 1 2663 4 2 5706 4 3 2363 4 4 9010 5 -5 2171 5 -4 7489 5 -3 8240 5 -2 2164 5 -1 5542 5 0 7619 5 1 913 5 2 759...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #16:
score: 0
Accepted
time: 2553ms
memory: 46164kb
input:
99 1 -1 4146 1 0 690 1 1 7949 2 -2 2843 2 -1 1430 2 0 5620 2 1 748 2 2 7067 3 -3 4536 3 -2 783 3 -1 8035 3 0 2226 3 1 5185 3 2 7038 3 3 9853 4 -4 5629 4 -3 1224 4 -2 5748 4 -1 9923 4 0 3359 4 1 2257 4 2 4766 4 3 4944 4 4 4955 5 -5 3318 5 -4 2726 5 -3 5411 5 -2 1025 5 -1 355 5 0 1001 5 1 2549 5 2 949...
output:
12785 163473933 915237012 254149183 680683147 479540734 314139149 214864529 298718215 688048492 470367494 483243065 78287652 733192051 334304326 621201728 297250370 513376725 232026014 560684823 894478168 330678358 938834519 544411347 221349086 905611720 427110161 116377854 146574295 259374356 21919...
result:
ok 30000 numbers
Test #17:
score: 0
Accepted
time: 2556ms
memory: 45976kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
10780 116235433 512745292 102182564 227534377 212855856 35512430 725517548 508741224 210839521 415013452 495541530 777916022 798768295 600229176 930580628 669108417 598202880 774201119 913409428 310051635 313593448 406778915 158270049 463181070 277256835 62357313 962667036 33844388 337505436 1617232...
result:
ok 30000 numbers
Test #18:
score: 0
Accepted
time: 2545ms
memory: 45888kb
input:
99 1 -1 9676 1 0 5629 1 1 8650 2 -2 2598 2 -1 3309 2 0 4693 2 1 4686 2 2 80 3 -3 116 3 -2 2249 3 -1 6667 3 0 1528 3 1 6679 3 2 7864 3 3 9421 4 -4 8405 4 -3 8826 4 -2 6816 4 -1 7516 4 0 7726 4 1 8666 4 2 9087 4 3 7681 4 4 9964 5 -5 1340 5 -4 5686 5 -3 6021 5 -2 1662 5 -1 4721 5 0 6064 5 1 9309 5 2 41...
output:
23955 573857391 298943296 10820069 779475040 95900122 89723523 185888308 922246273 369556247 518801389 491834807 831660585 174969508 992080716 824972382 615675521 950857730 295856112 311318899 21519670 609865668 8371556 583904124 116709464 595118713 703071664 63155980 476296708 520364931 303340294 5...
result:
ok 30000 numbers
Test #19:
score: 0
Accepted
time: 2551ms
memory: 46044kb
input:
99 1 -1 799 1 0 8352 1 1 448 2 -2 3882 2 -1 540 2 0 8315 2 1 4575 2 2 8762 3 -3 9567 3 -2 2336 3 -1 8397 3 0 1418 3 1 9897 3 2 5828 3 3 3851 4 -4 6816 4 -3 4230 4 -2 4449 4 -1 6925 4 0 658 4 1 229 4 2 4520 4 3 940 4 4 9560 5 -5 5147 5 -4 5162 5 -3 1655 5 -2 675 5 -1 792 5 0 2361 5 1 1754 5 2 6398 5 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #20:
score: 0
Accepted
time: 2558ms
memory: 46044kb
input:
99 1 -1 8419 1 0 5565 1 1 3805 2 -2 7585 2 -1 6216 2 0 1450 2 1 1615 2 2 2609 3 -3 1064 3 -2 9166 3 -1 6893 3 0 6074 3 1 3509 3 2 300 3 3 9695 4 -4 9573 4 -3 5589 4 -2 3161 4 -1 1172 4 0 7968 4 1 7358 4 2 6031 4 3 6268 4 4 9426 5 -5 8510 5 -4 422 5 -3 774 5 -2 8779 5 -1 910 5 0 3552 5 1 4182 5 2 539...
output:
0 14480634 382132464 944519322 62408081 37821897 447698710 637407838 710873601 710117885 754507152 706548102 270456197 626365400 544497634 355742797 478771901 826784493 353840122 4765500 908169127 546600408 406895236 798274238 396891096 961701043 324904599 864575152 200122682 344129815 920489759 375...
result:
ok 30000 numbers
Test #21:
score: 0
Accepted
time: 2563ms
memory: 45892kb
input:
99 1 -1 6486 1 0 9677 1 1 5969 2 -2 1643 2 -1 7534 2 0 5677 2 1 2668 2 2 1068 3 -3 1991 3 -2 2196 3 -1 7783 3 0 6828 3 1 7727 3 2 9426 3 3 5871 4 -4 697 4 -3 7612 4 -2 8703 4 -1 1027 4 0 1408 4 1 5545 4 2 9508 4 3 7185 4 4 238 5 -5 4237 5 -4 6443 5 -3 1313 5 -2 2501 5 -1 8850 5 0 5128 5 1 2111 5 2 3...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #22:
score: 0
Accepted
time: 2558ms
memory: 46176kb
input:
99 1 -1 6365 1 0 2075 1 1 7586 2 -2 1386 2 -1 7833 2 0 8360 2 1 3330 2 2 6048 3 -3 8928 3 -2 9492 3 -1 2433 3 0 3840 3 1 6766 3 2 1735 3 3 9810 4 -4 1599 4 -3 1837 4 -2 1892 4 -1 1982 4 0 7328 4 1 9352 4 2 1369 4 3 1244 4 4 1794 5 -5 6608 5 -4 9252 5 -3 1647 5 -2 7432 5 -1 9535 5 0 7208 5 1 3264 5 2...
output:
16026 256859633 104822572 872797647 600569906 619463428 246571410 346526007 861617115 397391210 979595088 644563130 492102687 276440922 933473025 326484394 937791665 33392026 621833872 751119019 254320325 541742532 990052117 251315918 292159844 570404983 949753010 669740985 674378707 188068833 29476...
result:
ok 30000 numbers
Test #23:
score: 0
Accepted
time: 2564ms
memory: 46168kb
input:
99 1 -1 8162 1 0 6955 1 1 3183 2 -2 8394 2 -1 180 2 0 6097 2 1 3065 2 2 7065 3 -3 2513 3 -2 9261 3 -1 2578 3 0 1078 3 1 6878 3 2 4140 3 3 4611 4 -4 1947 4 -3 2445 4 -2 170 4 -1 9975 4 0 3489 4 1 4750 4 2 6149 4 3 3333 4 4 3865 5 -5 2214 5 -4 7282 5 -3 7007 5 -2 7432 5 -1 8896 5 0 6367 5 1 8522 5 2 4...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #24:
score: 0
Accepted
time: 2574ms
memory: 46052kb
input:
99 1 -1 3245 1 0 6473 1 1 8274 2 -2 1550 2 -1 4353 2 0 1181 2 1 4287 2 2 2699 3 -3 8110 3 -2 8643 3 -1 7465 3 0 7172 3 1 2529 3 2 9981 3 3 2112 4 -4 3476 4 -3 4381 4 -2 8247 4 -1 6890 4 0 6671 4 1 8805 4 2 2372 4 3 32 4 4 3989 5 -5 9320 5 -4 3165 5 -3 5431 5 -2 9658 5 -1 1293 5 0 7206 5 1 6578 5 2 6...
output:
17992 323726134 976240978 85656196 995389313 721342545 114561058 778932059 173419318 340330444 460190276 62788786 173863052 7760190 328127553 350788223 920573824 132129146 186363590 129280073 203556472 257137808 641131296 431032081 564068818 989266746 296151539 966385063 240136169 166643525 23048898...
result:
ok 30000 numbers
Test #25:
score: 0
Accepted
time: 2557ms
memory: 45984kb
input:
99 1 -1 3093 1 0 6584 1 1 987 2 -2 761 2 -1 493 2 0 8217 2 1 9501 2 2 7482 3 -3 9447 3 -2 5665 3 -1 753 3 0 2104 3 1 5084 3 2 9095 3 3 3525 4 -4 221 4 -3 3964 4 -2 1781 4 -1 4872 4 0 8106 4 1 3656 4 2 3343 4 3 2593 4 4 7080 5 -5 6080 5 -4 4868 5 -3 1411 5 -2 3713 5 -1 968 5 0 3251 5 1 7216 5 2 2079 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 30000 numbers
Test #26:
score: 0
Accepted
time: 2546ms
memory: 46048kb
input:
99 1 -1 7922 1 0 4512 1 1 9248 2 -2 6018 2 -1 7368 2 0 3717 2 1 9714 2 2 7650 3 -3 3290 3 -2 3335 3 -1 2759 3 0 3169 3 1 1895 3 2 5303 3 3 2640 4 -4 1979 4 -3 4199 4 -2 9105 4 -1 4791 4 0 8661 4 1 8681 4 2 3652 4 3 8753 4 4 4033 5 -5 2029 5 -4 5987 5 -3 7042 5 -2 6253 5 -1 83 5 0 1420 5 1 5814 5 2 2...
output:
13760 335883993 887889718 633973106 39650655 242317723 331022121 47707171 312761489 312072688 381303356 139739423 924680896 797440931 98825261 621234405 58565496 64054316 481060016 352979699 149052562 595640910 361423032 718826674 856483402 450563653 224597419 456657140 146495860 157655903 857999791...
result:
ok 30000 numbers
Test #27:
score: 0
Accepted
time: 2563ms
memory: 46000kb
input:
99 1 -1 41 1 0 8467 1 1 6334 2 -2 10000 2 -1 9169 2 0 5724 2 1 1478 2 2 9358 3 -3 0 3 -2 4464 3 -1 5705 3 0 8145 3 1 3281 3 2 6827 3 3 9961 4 -4 491 4 -3 2995 4 -2 1942 4 -1 4827 4 0 5436 4 1 2391 4 2 4604 4 3 3902 4 4 153 5 -5 292 5 -4 2382 5 -3 7421 5 -2 8716 5 -1 9718 5 0 9895 5 1 5447 5 2 1726 5...
output:
0 0 0 0 224166795 430568553 91816617 825432809 589683966 426529589 514025077 986683173 886262765 21038753 526986891 486941167 56839645 492608275 698845177 144248308 130241 544836658 865356192 825757585 472285552 802565189 541915607 118864220 550491625 351456674 877803862 443886107 151768449 23988810...
result:
ok 30000 numbers
Test #28:
score: 0
Accepted
time: 61ms
memory: 18596kb
input:
99 1 -1 41 1 0 8467 1 1 6334 2 -2 10000 2 -1 9169 2 0 5724 2 1 1478 2 2 9358 3 -3 0 3 -2 4464 3 -1 5705 3 0 8145 3 1 3281 3 2 6827 3 3 9961 4 -4 491 4 -3 2995 4 -2 1942 4 -1 4827 4 0 5436 4 1 2391 4 2 4604 4 3 3902 4 4 153 5 -5 292 5 -4 2382 5 -3 7421 5 -2 8716 5 -1 9718 5 0 9895 5 1 5447 5 2 1726 5...
output:
14801 219605549 918066257 950671703 802417909 12689425 651470453 668726789 656702846 529799494 448867319 797291650 327815384 866928650 304675446 992037538 727739766 877086122 419920722 278777150 54657885 416067248 672603882 914458713 287250900 924172886 676259721 203441812 170974687 242140403 281533...
result:
ok 300 numbers
Test #29:
score: 0
Accepted
time: 65ms
memory: 18612kb
input:
99 1 -1 41 1 0 8467 1 1 6334 2 -2 10000 2 -1 9169 2 0 5724 2 1 1478 2 2 9358 3 -3 0 3 -2 4464 3 -1 5705 3 0 8145 3 1 3281 3 2 6827 3 3 9961 4 -4 491 4 -3 2995 4 -2 1942 4 -1 4827 4 0 5436 4 1 2391 4 2 4604 4 3 3902 4 4 153 5 -5 292 5 -4 2382 5 -3 7421 5 -2 8716 5 -1 9718 5 0 9895 5 1 5447 5 2 1726 5...
output:
0 0 0 0 224166795 430568553 91816617 825430372 517344058 915400381 471409539 731358225 283433919 52631601 335345565 981450458 475779366 259134787 95339171 867847057 158514606 470891910 688465073 32491550 936976300 578619792 134034600 67545002 167393818 860526534 963230853 346599208 160897506 3418797...
result:
ok 300 numbers
Test #30:
score: 0
Accepted
time: 63ms
memory: 18588kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
10780 116235433 512745292 102182564 227534377 212855856 35512430 725517548 508741224 210839521 415013452 495541530 777916022 798768295 600229176 930580628 669108417 598202880 774201119 913409428 310051635 313593448 406778915 158270049 463181070 277256835 62357313 962667036 33844388 337505436 1617232...
result:
ok 300 numbers
Test #31:
score: 0
Accepted
time: 62ms
memory: 18492kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
6625 87655919 636581604 585696387 17620788 88066998 904901665 846840737 360330214 620333919 136263062 39075213 241172245 519044851 379562425 532682226 777144743 462280426 307921116 700072043 707231396 323401925 598314068 841884023 28387679 166454723 975772805 448135193 488726970 475593671 612544405 ...
result:
ok 100 numbers