QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#874248 | #9685. nim 游戏 | cooluo | 28 | 149ms | 30552kb | C++23 | 16.9kb | 2025-01-27 21:24:41 | 2025-01-27 21:24:42 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ul unsigned ll
#define LL __int128_t
#define db double
#define DB long db
#define pii pair<int, int>
#define fi first
#define se second
#define mkpr make_pair
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define rsz resize
#define eb emplace_back
#define all(c) (c).begin(), (c).end()
#define bit(k) (1 << (k))
#define Bit(k) (1ll << (k))
#define BIT(k) ((LL)1 << (k))
#define lowbit(x) ((x) & -(x))
#define bin(s, k) ((s) >> (k) & 1)
#define lg2(x) (31 - __builtin_clz(x))
#define LG2(x) (63 - __builtin_clzll(x))
#define popcnt(x) __builtin_popcount(x)
#define mem(a, x) memset(a, x, sizeof(a))
#define req(i, l, r) for (int i(l), i##End(r); i < i##End; i = -~i)
#define rep(i, l, r) for (int i(l), i##End(r); i <= i##End; i = -~i)
#define per(i, r, l) for (int i(r), i##End(l); i >= i##End; i = ~-i)
#ifdef JYR
#include "debug.h"
#define errs(x) fputs(x "\n", stderr)
#define errm(x, ...) fprintf(stderr, x, ##__VA_ARGS__)
#else
#define dbg(...) 0
#define dbgArr(...) 0
#define errs(x) 0
#define errm(x, ...) 0
#endif
template<typename T, typename U> void chkmx(T &_a, U _b) { if (_a < _b) _a = _b; }
template<typename T, typename U> void chkmn(T &_a, U _b) { if (_b < _a) _a = _b; }
bool Mbe;
struct FastIO {
char buf[1 << 20], *p1, *p2;
char puf[1 << 20], *pf;
FastIO() : p1(buf), p2(buf), pf(puf) {}
~FastIO() { fwrite(puf, 1, pf - puf, stdout); }
char gc() {
if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin);
return p1 == p2 ? EOF : *p1++;
}
bool blank(char c) { return c == ' ' || c == '\r' || c == '\n' || c == '\t'; }
char rd() {
char c = gc(); while (blank(c)) c = gc();
return c;
}
template<typename T> T rd() {
T x = 0; int f = 0; char c = gc();
while (!isdigit(c)) f = (c == '-'), c = gc();
while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
return f ? -x : x;
}
int rds(char *s) {
char c = gc(), *S = s;
while (blank(c)) c = gc();
while (!blank(c) && c != EOF) *s++ = c, c = gc();
return *s = 0, abs(s - S);
}
int rdl(char *s) {
char c = gc(), *S = s;
while (c == '\r' || c == '\n') c = gc();
while (c != '\r' && c != '\n' && c != EOF) *s++ = c, c = gc();
return *s = 0, abs(s - S);
}
void rd(char &c) { c = rd(); }
void rd(char *s) {
char c = gc();
while (blank(c)) c = gc();
if (c == EOF) { *s = 0; return; }
while (!blank(c) && c != EOF) *s++ = c, c = gc();
*s = 0;
}
template<typename T> void rd(T &x) {
x = 0; int f = 0; char c = gc();
while (!isdigit(c)) f = (c == '-'), c = gc();
while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
if (f) x = -x;
}
template<typename T, typename... Ts>
void rd(T& x, Ts&... xs) { rd(x), rd(xs...); }
void pc(const char &c) {
if (pf - puf == 1 << 20) fwrite(pf = puf, 1, 1 << 20, stdout);
*pf++ = c;
}
void prt(char c) { pc(c); }
void prt(char* s) { while (*s) pc(*s++); }
void prt(const char* s) { while (*s) pc(*s++); }
template<typename T> void prt(T x) {
static int st[41], tp = 0;
if (x == 0) { pc('0'); return; }
if (x < 0) x = -x, pc('-');
while (x) st[++tp] = x % 10, x /= 10;
while (tp) pc(st[tp--] + '0');
}
template<typename T> void prt(T *x) { while (*x) pc(*x++); }
template<typename T, typename... Ts>
void prt(T x, Ts... xs) { prt(x), prt(xs...); }
void prts(const char *s, char c = '\n') {
while (*s) pc(*s++);
if (c) pc(c);
}
} IO;
#define rd IO.rd
#define rdl IO.rdl
#define ri rd<int>()
#define rl rd<ll>()
#define prt IO.prt
#define prs IO.prts
#define edl IO.pc('\n')
#define MC
#define N 100005
#define mod 998244353
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pli pair<ll, int>
#define vli vector<pli>
#define pb pop_back
int TID, n, m;
ll ans;
ll a[N];
int p[63][N];
int vt[N], tp;
vli st;
vector<vli> res;
bool vs[N];
ll dfs1(ll xs, int k, bool fg) {
if (k < 0) return 0;
ll K = BIT(k) - 1;
if (bin(xs, k)) {
rep(_, 1, n) if (int i = p[k][_]; !vs[i] && !bin(a[i], k)) {
vs[i] = 1;
ll x = K + 1 - (a[i] & K) + dfs1(xs ^ (a[i] & K), k - 1, 1);
return vs[i] = 0, x;
}
if (fg) return K + 1 + dfs1(xs, k - 1, fg);
return INF;
}
ll x = dfs1(xs, k - 1, fg);
if (!fg) rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
if (bin(a[i], k)) break;
rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
if (bin(a[j], k)) break;
vs[i] = vs[j] = 1;
chkmn(x, K + 1 - (a[i] & K) - (a[j] & K) + K + 1
+ dfs1(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1));
return vs[i] = vs[j] = 0, x;
}
}
return x;
}
bool dfs2(ll xs, int k, bool fg, ll su) {
// dbg(xs, k, fg, su, st);
if (su > ans) return 1;
if (k < 0) {
if (res.size() == m) return 0;
return res.eb(st), 1;
}
ll K = BIT(k) - 1;
bool bk = 0;
if (bin(xs, k)) {
rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
if (bin(a[i], k)) break;
vs[i] = 1, st.eb(K + 1 - (a[i] & K), i), vt[++tp] = i;
bool tg = dfs2(xs ^ (a[i] & K), k - 1, 1, su + K + 1 - (a[i] & K));
vs[i] = 0, st.pb(), tp--;
if (!tg) return bk; bk = 1;
}
if (fg) {
rep(_, 1, tp) {
int i = vt[_];
st.eb(K + 1, i);
bool tg = dfs2(xs, k - 1, fg, su + K + 1);
if (st.pb(); !tg) return bk; bk = 1;
}
}
return bk;
}
bk = dfs2(xs, k - 1, fg, su);
// if (k == 3 && su == 0) dbgArr(p[k] + 1, n), dbgArr(vs + 1, n);
if (!fg) rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
// dbg(_, k, p[k][_], i);
if (bin(a[i], k)) break;
rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
// dbg(__, k, p[k][__], j);
if (bin(a[j], k)) break;
ll x = K + 1 - (a[i] & K), y = K + 1 - (a[j] & K);
vs[i] = vs[j] = 1, st.eb(x, i), st.eb(y, j), vt[++tp] = i, vt[++tp] = j;
bool tg = dfs2(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1, su + x + y);
vs[i] = vs[j] = 0, st.pb(), st.pb(), ----tp;
if (!tg) return bk; bk = 1;
}
}
return bk;
}
/*
7 7 7 6 2 2 3
0111
0111
0111
0110
0010
0010
0011
*/
void mslv() {
rd(n, m), st.clear(), res.clear();
ll xs = 0;
rep(i, 1, n) xs ^= a[i] = rl;
rep(k, 0, 60) {
rep(i, 1, n) p[k][i] = i;
ll K = BIT(k) - 1;
sort(p[k] + 1, p[k] + n + 1, [&](int i, int j) {
return (bin(a[i], k) ? -1 : a[i] & K)
> (bin(a[j], k) ? -1 : a[j] & K);
});
}
ans = dfs1(xs, 60, 0);
dfs2(xs, 60, 0, 0);
prt(ans, '\n', res.size(), '\n');
for (auto ve : res) {
sort(all(ve), [](pli x, pli y) { return x.se < y.se; });
vli vc;
for (auto [x, i] : ve) {
if (vc.empty() || vc.back().se != i) vc.eb(x, i);
else vc.back().fi += x;
}
prt(vc.size(), '\n');
for (auto [x, i] : vc) prt(i, ' '); edl;
for (auto [x, i] : vc) prt(x, ' '); edl;
}
}
void mprw() {}
bool Med;
int main() {
#ifdef JYR
errs("Running!");
freopen("Test.in", "r", stdin);
freopen("Test.out", "w", stdout);
#endif
mprw();
#ifdef MC
int _; rd(TID, _);
while (_--) mslv();
#else
mslv();
#endif
errm("%.3lfMB %.0lfms\n", abs(&Med - &Mbe) / 1048576., clock() * 1000. / CLOCKS_PER_SEC);
return 0;
}
// #include <bits/stdc++.h>
// using namespace std;
// #define ll long long
// #define ul unsigned ll
// #define LL __int128_t
// #define db double
// #define DB long db
// #define pii pair<int, int>
// #define fi first
// #define se second
// #define mkpr make_pair
// #define vi vector<int>
// #define vl vector<ll>
// #define vii vector<pii>
// #define rsz resize
// #define eb emplace_back
// #define all(c) (c).begin(), (c).end()
// #define bit(k) (1 << (k))
// #define Bit(k) (1ll << (k))
// #define BIT(k) ((LL)1 << (k))
// #define lowbit(x) ((x) & -(x))
// #define bin(s, k) ((s) >> (k) & 1)
// #define lg2(x) (31 - __builtin_clz(x))
// #define LG2(x) (63 - __builtin_clzll(x))
// #define popcnt(x) __builtin_popcount(x)
// #define mem(a, x) memset(a, x, sizeof(a))
// #define req(i, l, r) for (int i(l), i##End(r); i < i##End; i = -~i)
// #define rep(i, l, r) for (int i(l), i##End(r); i <= i##End; i = -~i)
// #define per(i, r, l) for (int i(r), i##End(l); i >= i##End; i = ~-i)
// #ifdef JYR
// #include "debug.h"
// #define errs(x) fputs(x "\n", stderr)
// #define errm(x, ...) fprintf(stderr, x, ##__VA_ARGS__)
// #else
// #define dbg(...) 0
// #define dbgArr(...) 0
// #define errs(x) 0
// #define errm(x, ...) 0
// #endif
// template<typename T, typename U> void chkmx(T &_a, U _b) { if (_a < _b) _a = _b; }
// template<typename T, typename U> void chkmn(T &_a, U _b) { if (_b < _a) _a = _b; }
// bool Mbe;
// struct FastIO {
// char buf[1 << 20], *p1, *p2;
// char puf[1 << 20], *pf;
// FastIO() : p1(buf), p2(buf), pf(puf) {}
// ~FastIO() { fwrite(puf, 1, pf - puf, stdout); }
// char gc() {
// if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin);
// return p1 == p2 ? EOF : *p1++;
// }
// bool blank(char c) { return c == ' ' || c == '\r' || c == '\n' || c == '\t'; }
// char rd() {
// char c = gc(); while (blank(c)) c = gc();
// return c;
// }
// template<typename T> T rd() {
// T x = 0; int f = 0; char c = gc();
// while (!isdigit(c)) f = (c == '-'), c = gc();
// while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
// return f ? -x : x;
// }
// int rds(char *s) {
// char c = gc(), *S = s;
// while (blank(c)) c = gc();
// while (!blank(c) && c != EOF) *s++ = c, c = gc();
// return *s = 0, abs(s - S);
// }
// int rdl(char *s) {
// char c = gc(), *S = s;
// while (c == '\r' || c == '\n') c = gc();
// while (c != '\r' && c != '\n' && c != EOF) *s++ = c, c = gc();
// return *s = 0, abs(s - S);
// }
// void rd(char &c) { c = rd(); }
// void rd(char *s) {
// char c = gc();
// while (blank(c)) c = gc();
// if (c == EOF) { *s = 0; return; }
// while (!blank(c) && c != EOF) *s++ = c, c = gc();
// *s = 0;
// }
// template<typename T> void rd(T &x) {
// x = 0; int f = 0; char c = gc();
// while (!isdigit(c)) f = (c == '-'), c = gc();
// while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
// if (f) x = -x;
// }
// template<typename T, typename... Ts>
// void rd(T& x, Ts&... xs) { rd(x), rd(xs...); }
// void pc(const char &c) {
// if (pf - puf == 1 << 20) fwrite(pf = puf, 1, 1 << 20, stdout);
// *pf++ = c;
// }
// void prt(char c) { pc(c); }
// void prt(char* s) { while (*s) pc(*s++); }
// void prt(const char* s) { while (*s) pc(*s++); }
// template<typename T> void prt(T x) {
// static int st[41], tp = 0;
// if (x == 0) { pc('0'); return; }
// if (x < 0) x = -x, pc('-');
// while (x) st[++tp] = x % 10, x /= 10;
// while (tp) pc(st[tp--] + '0');
// }
// template<typename T> void prt(T *x) { while (*x) pc(*x++); }
// template<typename T, typename... Ts>
// void prt(T x, Ts... xs) { prt(x), prt(xs...); }
// void prts(const char *s, char c = '\n') {
// while (*s) pc(*s++);
// if (c) pc(c);
// }
// } IO;
// #define rd IO.rd
// #define rdl IO.rdl
// #define ri rd<int>()
// #define rl rd<ll>()
// #define prt IO.prt
// #define prs IO.prts
// #define edl IO.pc('\n')
// #define MC
// #define N 100005
// #define mod 998244353
// #define inf 0x3f3f3f3f
// #define INF 0x3f3f3f3f3f3f3f3f
// #define pli pair<ll, int>
// #define vli vector<pli>
// #define pb pop_back
// int TID, n, m;
// ll ans;
// ll a[N];
// int p[63][N];
// int vt[N], tp;
// vli st;
// vector<vli> res;
// bool vs[N];
// ll dfs1(ll xs, int k, bool fg) {
// if (k < 0) return 0;
// ll K = BIT(k) - 1;
// if (bin(xs, k)) {
// rep(_, 1, n) if (int i = p[k][_]; !vs[i] && !bin(a[i], k)) {
// vs[i] = 1;
// ll x = K + 1 - (a[i] & K) + dfs1(xs ^ (a[i] & K), k - 1, 1);
// return vs[i] = 0, x;
// }
// if (fg) return K + 1 + dfs1(xs, k - 1, fg);
// return INF;
// }
// ll x = dfs1(xs, k - 1, fg);
// if (!fg) rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
// if (bin(a[i], k)) break;
// rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
// if (bin(a[j], k)) break;
// vs[i] = vs[j] = 1;
// chkmn(x, K + 1 - (a[i] & K) - (a[j] & K) + K + 1
// + dfs1(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1));
// return vs[i] = vs[j] = 0, x;
// }
// }
// return x;
// }
// int dfs2(ll xs, int k, bool fg, ll su) {
// dbg(xs, k, fg, su, st);
// if (su > ans) return -1;
// if (k < 0) {
// if (res.size() == m) return 0;
// return res.eb(st), 1;
// }
// ll K = BIT(k) - 1;
// bool bk = 0;
// if (bin(xs, k)) {
// rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
// if (bin(a[i], k)) break;
// vs[i] = 1, st.eb(K + 1 - (a[i] & K), i), vt[++tp] = i;
// int tg = dfs2(xs ^ (a[i] & K), k - 1, 1, su + K + 1 - (a[i] & K));
// vs[i] = 0, st.pb(), tp--;
// if (!tg) return bk;
// if (!~tg) break;
// bk = 1;
// }
// if (fg) {
// rep(_, 1, tp) {
// int i = vt[_];
// st.eb(K + 1, i);
// int tg = dfs2(xs, k - 1, fg, su + K + 1);
// if (st.pb(); !tg) return bk;
// if (!~tg) break;
// bk = 1;
// }
// }
// return bk;
// }
// bk = dfs2(xs, k - 1, fg, su);
// if (k == 3 && su == 0) dbgArr(p[k] + 1, n), dbgArr(vs + 1, n);
// int t = n + 1;
// if (!fg) rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
// dbg(_, k, p[k][_], i);
// if (bin(a[i], k) || _ >= t) break;
// rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
// dbg(__, k, p[k][__], j);
// if (bin(a[j], k)) break;
// ll x = K + 1 - (a[i] & K), y = K + 1 - (a[j] & K);
// vs[i] = vs[j] = 1, st.eb(x, i), st.eb(y, j), vt[++tp] = i, vt[++tp] = j;
// int tg = dfs2(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1, su + x + y);
// vs[i] = vs[j] = 0, st.pb(), st.pb(), ----tp;
// if (!tg) return bk;
// if (!~tg) { t = __; break; }
// bk = 1;
// }
// }
// return bk;
// }
// /*
// 7 7 7 6 2 2 3
// 0111
// 0111
// 0111
// 0110
// 0010
// 0010
// 0011
// */
// void mslv() {
// rd(n, m), st.clear(), res.clear();
// ll xs = 0;
// rep(i, 1, n) xs ^= a[i] = rl;
// rep(k, 0, 60) {
// rep(i, 1, n) p[k][i] = i;
// ll K = BIT(k) - 1;
// sort(p[k] + 1, p[k] + n + 1, [&](int i, int j) {
// return (bin(a[i], k) ? -1 : a[i] & K)
// > (bin(a[j], k) ? -1 : a[j] & K);
// });
// }
// ans = dfs1(xs, 60, 0), dfs2(xs, 60, 0, 0);
// prt(ans, '\n', res.size(), '\n');
// for (auto ve : res) {
// sort(all(ve), [](pli x, pli y) { return x.se < y.se; });
// vli vc;
// for (auto [x, i] : ve) {
// if (vc.empty() || vc.back().se != i) vc.eb(x, i);
// else vc.back().fi += x;
// }
// prt(vc.size(), '\n');
// for (auto [x, i] : vc) prt(i, ' '); edl;
// for (auto [x, i] : vc) prt(x, ' '); edl;
// }
// }
// void mprw() {}
// bool Med;
// int main() {
// #ifdef JYR
// errs("Running!");
// // freopen("Test.err", "w", stderr);
// freopen("Test.in", "r", stdin);
// freopen("Test.out", "w", stdout);
// #endif
// mprw();
// #ifdef MC
// int _; rd(TID, _);
// while (_--) mslv();
// #else
// mslv();
// #endif
// errm("%.3lfMB %.0lfms\n", abs(&Med - &Mbe) / 1048576., clock() * 1000. / CLOCKS_PER_SEC);
// return 0;
// }
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 4
Accepted
Test #1:
score: 4
Accepted
time: 149ms
memory: 28516kb
input:
1 10000 2 1 324097321 555675086 2 1 304655177 991244276 2 1 9980291 383616352 2 1 1071036550 795625380 2 1 682098056 68370721 2 1 969101726 685975156 2 1 973896269 354857775 2 1 196188000 606494155 2 1 754416123 467588829 2 1 495704303 558090120 2 1 618002000 491488050 2 1 741575237 9937018 2 1 1002...
output:
231577765 1 1 1 231577765 686589099 1 1 1 686589099 373636061 1 1 1 373636061 275411170 1 1 2 275411170 613727335 1 1 2 613727335 283126570 1 1 2 283126570 619038494 1 1 2 619038494 410306155 1 1 1 410306155 286827294 1 1 2 286827294 62385817 1 1 1 62385817 126513950 1 1 2 12651...
result:
ok correct answer
Subtask #2:
score: 12
Accepted
Test #2:
score: 12
Accepted
time: 0ms
memory: 28132kb
input:
2 5 5 2000 0 13 3 4 10 5 2000 0 3 9 1 11 5 2000 0 13 7 3 5 5 2000 0 1 13 9 2 5 2000 0 8 14 7 13
output:
0 1 0 0 1 0 2 2 2 2 3 1 1 2 3 5 1 1 3 2 2 1 5 1 2 1 5 3 2 1 2 4 5 1 1
result:
ok correct answer
Test #3:
score: 12
Accepted
time: 0ms
memory: 30296kb
input:
2 5 5 2000 0 4 14 5 7 5 2000 0 2 15 0 12 5 2000 0 1 14 0 5 5 2000 0 13 4 12 3 5 2000 0 10 10 1 11
output:
6 2 3 1 4 5 4 1 1 2 4 5 1 5 1 4 1 1 1 1 2 1 1 4 1 1 5 1 8 8 3 1 2 5 2 3 3 3 2 4 5 3 2 3 2 2 5 3 5 2 2 5 5 3 3 1 2 5 4 1 3 3 2 4 5 1 4 3 2 2 5 1 7 2 2 5 7 1 2 4 2 1 5 1 1 2 3 5 1 1 2 4 5 1 1 1 5 2 10 13 3 1 2 4 2 1 7 3 1 3 4 2 1 7 2 1 4 2 8 2 1 4 3 7 2 1 4 ...
result:
ok correct answer
Test #4:
score: 12
Accepted
time: 0ms
memory: 30296kb
input:
2 5 5 2000 0 6 15 10 1 5 2000 0 15 0 13 10 5 2000 0 5 7 5 1 5 2000 0 13 3 2 15 5 2000 0 2 4 7 0
output:
2 5 2 1 5 1 1 2 2 5 1 1 2 4 5 1 1 1 5 2 1 1 2 8 2 1 1 8 1 3 8 4 2 2 2 5 1 3 2 4 5 1 3 1 1 1 2 1 1 4 1 1 1 1 2 1 1 3 1 1 5 1
result:
ok correct answer
Subtask #3:
score: 12
Accepted
Dependency #2:
100%
Accepted
Test #5:
score: 12
Accepted
time: 1ms
memory: 30412kb
input:
3 5 6 2000 0 45 517 811 107 132 6 2000 0 382 576 805 419 579 6 2000 0 379 809 441 331 67 6 2000 0 565 776 959 852 383 6 2000 0 613 383 829 47 441
output:
146 20 5 1 2 3 4 6 1 19 1 1 124 4 2 3 4 6 19 1 1 125 4 2 3 4 6 20 1 1 124 4 2 3 4 6 19 1 2 124 4 2 3 4 6 19 2 1 124 4 1 2 4 6 2 19 1 124 3 2 4 6 19 1 126 3 2 4 6 21 1 124 3 2 4 6 19 3 124 5 1 2 3 5 6 1 19 1 1 124 4 2 3 5 6 19 1 1 125 4 2 3 5 6 20 1 1 124 4 2 3 5 6 19 1 2 124...
result:
ok correct answer
Test #6:
score: 12
Accepted
time: 0ms
memory: 30296kb
input:
3 5 6 2000 0 75 173 555 637 905 6 2000 0 934 118 906 367 728 6 2000 0 244 321 598 625 469 6 2000 0 573 489 24 480 459 6 2000 0 424 356 750 623 871
output:
557 483 5 1 2 3 5 6 8 53 342 131 23 5 1 2 3 5 6 8 53 341 132 23 5 1 2 3 5 6 8 54 341 131 23 5 1 2 3 5 6 8 53 341 131 24 5 1 2 3 5 6 9 53 341 131 23 5 1 2 3 5 6 8 53 340 133 23 5 1 2 3 5 6 8 53 339 134 23 5 1 2 3 5 6 8 54 339 133 23 5 1 2 3 5 6 8 53 339 133 24 5 1 2 3 5 6 9 53 339 ...
result:
ok correct answer
Test #7:
score: 12
Accepted
time: 0ms
memory: 30552kb
input:
3 5 6 2000 0 886 972 226 813 407 6 2000 0 219 190 742 101 572 6 2000 0 590 423 516 1017 46 6 2000 0 388 807 207 205 647 6 2000 0 408 180 238 300 694
output:
176 25 5 1 2 4 5 6 8 10 30 19 109 5 1 2 4 5 6 8 10 34 19 105 5 1 2 4 5 6 8 14 30 19 105 5 1 2 4 5 6 8 10 30 23 105 5 1 2 4 5 6 12 10 30 19 105 5 1 2 4 5 6 4 10 30 19 113 4 2 4 5 6 10 30 19 117 4 2 4 5 6 10 34 19 113 4 2 4 5 6 14 30 19 113 4 2 4 5 6 10 30 23 113 5 1 2 4 5 6 4 10 ...
result:
ok correct answer
Subtask #4:
score: 0
Time Limit Exceeded
Test #8:
score: 0
Time Limit Exceeded
input:
4 257 100000 100 32768 65536 262144 32768 8388608 1048576 4 67108864 16384 32768 262144 8192 512 134217728 65536 4194304 262144 67108864 1024 262144 64 32 65536 2097152 268435456 1 2048 4194304 16777216 8 16384 2 2048 16777216 268435456 262144 1048576 8388608 16 268435456 2 128 4194304 262144 32768 ...
output:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #18:
score: 0
Time Limit Exceeded
input:
5 10000 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 10 1 0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741...
output:
result:
Subtask #6:
score: 0
Time Limit Exceeded
Test #22:
score: 16
Accepted
time: 74ms
memory: 28272kb
input:
6 23 1000 10 0 357293452 452461848 986047039 546588280 762710079 767831017 39741545 416114273 515599366 1018969624 603342125 928112286 1053016142 240953466 533088067 1028134429 504727014 371307863 834428873 968387878 478550336 1047217797 1046651542 777749850 866989319 92995163 251915198 363285573 10...
output:
264227 10 12 134 187 203 355 565 569 673 786 876 955 996 999 5 1 2638 9 531 1 1 697 251113 10 5226 3995 12 134 187 203 355 542 565 673 786 876 955 996 999 5 1 2638 9 1 531 1 697 251113 10 5226 3995 12 134 187 203 355 543 565 673 786 876 955 996 999 5 1 2638 9 1 531 1 697 251113 10 5226 3995 12...
result:
ok correct answer
Test #23:
score: 0
Time Limit Exceeded
input:
6 23 1000 10 0 978686021 287986921 276311856 889616598 739968417 1060147652 463275477 172393699 591333230 983197307 235514434 330494755 449056272 882229818 781111474 275587745 980041928 334198691 305313012 415758352 947298893 950211162 909723054 961622596 917454340 161928901 404346316 369133631 1038...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #3:
100%
Accepted
Dependency #5:
0%
Subtask #8:
score: 0
Skipped
Dependency #7:
0%
Subtask #9:
score: 0
Skipped
Dependency #8:
0%