QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#400940 | #6462. Jewel Thief | definieren | AC ✓ | 412ms | 18668kb | C++20 | 4.6kb | 2024-04-27 18:46:07 | 2024-04-27 18:46:08 |
Judging History
answer
#include <bits/stdc++.h>
#define fir first
#define sec second
#ifdef LOCAL
#define dbg(x) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << '\n';
#define dpi(x, y) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << " ; " << "the " << #y << " = " << y << '\n';
#define dbgf(fmt, args...) fprintf(stderr, fmt, ##args);
#else
#define dbg(x) void();
#define dpi(x, y) void();
#define dbgf(fmt, args...) void();
#endif
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vpii = vector<pii>;
bool Mbe;
constexpr int MOD = 998244353;
template<typename T> T add(T a, T b, T p = MOD) { return (a + b >= p) ? (a + b - p) : (a + b); }
template<typename T> T del(T a, T b, T p = MOD) { return (a - b < 0) ? (a - b + p) : (a - b); }
template<typename T> T mul(T a, T b, T p = MOD) { return 1ll * a * b % p; }
template<typename T> T cadd(T &a, T b, T p = MOD) { return a = add(a, b, p); }
template<typename T> T cdel(T &a, T b, T p = MOD) { return a = del(a, b, p); }
template<typename T> T cmul(T &a, T b, T p = MOD) { return a = mul(a, b, p); }
template<typename T> T cmax(T &a, T b) { return a = max(a, b); }
template<typename T> T cmin(T &a, T b) { return a = min(a, b); }
namespace FastIO {
constexpr int LEN = 1 << 20;
char in[LEN + 1], out[LEN + 1];
char *pin = in, *pout = out, *ein = in, *eout = out + LEN;
char gc() { return pin == ein && (ein = (pin = in) + fread(in, 1, LEN, stdin), ein == in) ? EOF : *pin ++; }
void pc(char c) { pout == eout && (fwrite(out, 1, LEN, stdout), pout = out); (*pout ++) = c; return; }
void Flush() { fwrite(out, 1, pout - out, stdout); pout = out; }
template<typename T> T Read() {
T x = 0; int f = 1; char ch = gc();
while (ch < '0' || ch > '9') f = (ch == '-' ? (~f + 1) : f), ch = gc();
while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gc();
return x * f;
}
template<typename T> void Write(T x, char c) {
static char stk[40]; int tp = 0;
if (x < 0) pc('-'), x = ~x + 1;
do stk[tp++] = x % 10 + 48, x /= 10; while (x);
while (tp --) pc(stk[tp]); pc(c); return;
}
void Read(char *s) {
char ch = gc();
while (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9'))) ch = gc();
while ((ch != EOF) && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9'))) *s = ch, s ++, ch = gc();
*s = '\0'; return;
}
void Write(char *s) {
while (*s != '\0') pc(*s), s ++; return;
}
void Puts(char *s) {
Write(s), pc('\n'); return;
}
}
#define getchar FastIO::gc
#define putchar FastIO::pc
#define Flush FastIO::Flush
#define Read FastIO::Read
#define Write FastIO::Write
#define Puts FastIO::Puts
constexpr int MAXN = 1e6 + 5, MAXK = 1e5 + 5, MAXS = 3e2 + 5;
int n, m;
ll w[MAXN], f[2][MAXK];
vector<int> obj[MAXS], pos;
void solve(int p, int o, int l, int r, int L, int R) {
if (l > r) return;
if (L == R) {
for (int i = l; i <= r; i ++)
f[o][pos[i]] = f[o ^ 1][pos[L]] + w[i - L];
return;
}
int mid = l + r >> 1, opt = max(L, mid - (int)obj[p].size());
ll ret = f[o ^ 1][pos[opt]] + w[mid - opt], tmp;
for (int i = opt + 1, lim = min(mid, R); i <= lim; i ++)
if ((tmp = f[o ^ 1][pos[i]] + w[mid - i]) > ret) ret = tmp, opt = i;
f[o][pos[mid]] = ret;
solve(p, o, l, mid - 1, L, opt), solve(p, o, mid + 1, r, opt, R);
return;
}
void slv() {
n = Read<int>(), m = Read<int>();
for (int i = 1; i <= n; i ++) {
int s = Read<int>(), v = Read<int>();
obj[s].emplace_back(v);
}
int now = 0, pre = 1;
for (int i = 1; i <= 300; i ++) {
if (obj[i].empty()) continue;
swap(now, pre);
sort(obj[i].begin(), obj[i].end(), greater<int>());
for (int j = 1; j <= obj[i].size(); j ++)
w[j] = w[j - 1] + obj[i][j - 1];
for (int j = 0; j < i; j ++) {
pos.clear();
for (int k = j; k <= m; k += i)
pos.emplace_back(k);
if (pos.empty()) continue;
solve(i, now, 0, pos.size() - 1, 0, pos.size() - 1);
}
}
for (int i = 1; i <= m; i ++)
Write(cmax(f[now][i], f[now][i - 1]), ' ');
return;
}
void clr() {
return;
}
bool Med;
int main() {
#ifdef LOCAL
freopen("!in.in", "r", stdin);
freopen("!out.out", "w", stdout);
fprintf(stderr, "%.3lf Mb\n", fabs((&Mbe - &Med) / 1048576.0));
#endif
int T = 1;
// int T = Read<int>();
while (T --) slv(), clr();
Flush();
#ifdef LOCAL
fprintf(stderr, "%d ms\n", (int)clock());
#endif
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5708kb
input:
4 9 2 8 1 1 3 4 5 100
output:
1 8 9 9 100 101 108 109 109
result:
ok single line: '1 8 9 9 100 101 108 109 109 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
5 7 2 2 3 8 2 7 2 4 3 8
output:
0 7 8 11 15 16 19
result:
ok single line: '0 7 8 11 15 16 19 '
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 6 300 1 300 2
output:
0 0 0 0 0 0
result:
ok single line: '0 0 0 0 0 0 '
Test #4:
score: 0
Accepted
time: 36ms
memory: 18604kb
input:
1000000 100000 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59...
output:
1000000 1999999 2999997 3999994 4999990 5999985 6999979 7999972 8999964 9999955 10999945 11999934 12999922 13999909 14999895 15999880 16999864 17999847 18999829 19999810 20999790 21999769 22999747 23999724 24999700 25999675 26999649 27999622 28999594 29999565 30999535 31999504 32999472 33999439 3499...
result:
ok single line: '1000000 1999999 2999997 399999...249997 94999149999 95000050000 '
Test #5:
score: 0
Accepted
time: 361ms
memory: 13028kb
input:
1000000 100000 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52...
output:
999900 1999500 2998800 3997800 4996500 5994900 6993000 7990800 8988300 9985500 10982400 11979000 12975300 13971300 14967000 15962400 16957500 17952300 18946800 19941000 20934900 21928500 22921800 23914800 24907500 25899900 26892000 27883800 28875300 29866500 30857400 31848000 32838300 33828300 34818...
result:
ok single line: '999900 1999500 2998800 3997800...391158 14095465559 14095540259 '
Test #6:
score: 0
Accepted
time: 412ms
memory: 14240kb
input:
1000000 100000 215 147097103 134 678126202 99 584874219 117 706686049 115 916008673 30 162264571 258 432473996 198 594445641 220 297145909 65 930644070 244 407860992 142 29223115 88 672186982 159 425618716 135 940015882 157 487536108 231 274342869 186 476447051 218 224412395 246 190206170 40 9447381...
output:
999806703 1999387329 2998933273 3997600596 4996253636 5994813962 6993341251 7991739112 8990090915 9988030031 10985967744 11983790477 12981604791 13979203678 14976661166 15973082139 16969021626 17964792681 18960320420 19955515110 20950479371 21945397018 22939871008 23934321385 24928593459 25922728871...
result:
ok single line: '999806703 1999387329 299893327... 14030752721202 14030826574137 '
Test #7:
score: 0
Accepted
time: 404ms
memory: 14516kb
input:
1000000 100000 276 486439797 78 332192431 177 149331902 205 326469917 62 299418832 100 105216428 37 535809017 4 907429843 85 489556625 232 611694228 140 851732325 88 439535327 210 842244665 192 833765518 108 468815050 283 562360222 45 524644417 174 261303298 196 868413682 71 269288419 68 763489570 2...
output:
999952362 1999046086 2997605897 3995568380 4993245770 5990739901 6988183483 7985611765 8982786564 9979648673 10976385153 11972735383 12968964171 13965077494 14960714942 15954774493 16947942489 17941033993 18934101155 19927079998 20919698313 21912088112 22904355648 23896371831 24888301660 25880120864...
result:
ok single line: '999952362 1999046086 299760589... 14072664773620 14072739138829 '
Test #8:
score: 0
Accepted
time: 391ms
memory: 13536kb
input:
1000000 100000 53 136327709 225 766761421 116 360378262 140 440492548 248 328435669 211 366342678 127 816570730 227 590613511 62 742067716 142 435660809 178 857831655 20 418529045 116 422302 102 632588249 163 612181607 186 667148706 159 457898250 113 977020169 286 648065211 266 218937379 68 28371329...
output:
999761872 1999394231 2998842070 3997492823 4995671154 5993680245 6991581366 7989443370 8986423253 9982264154 10977930879 11973157999 12968271667 13962835018 14957396737 15951881777 16946046050 17940120886 18934102404 19927806514 20920817505 21913759795 22905962735 23897531693 24888483311 25878856449...
result:
ok single line: '999761872 1999394231 299884207... 14128891913946 14128966557075 '
Test #9:
score: 0
Accepted
time: 395ms
memory: 12972kb
input:
1000000 100000 101 793296436 137 605204154 85 363620904 134 632573190 257 27613487 90 287977105 282 914889858 54 860546284 41 847837905 257 33185728 192 980309638 104 610219578 61 643062100 11 777815592 224 747718881 38 449696420 24 263912585 256 156471676 276 92793827 71 284887813 259 887442002 94 ...
output:
999572837 1998158938 2996411421 3994154966 4991734366 5988967099 6986012373 7983017116 8979625056 9975907607 10971775012 11967245931 12962707427 13957864243 14952965902 15948000558 16942808410 17937534727 18931735671 19925778405 20919711237 21912928201 22905686887 23898301052 24890681787 25883045091...
result:
ok single line: '999572837 1998158938 299641142... 14094082480223 14094156843676 '
Test #10:
score: 0
Accepted
time: 394ms
memory: 12528kb
input:
1000000 100000 261 795269977 1 232017324 115 284432088 159 563880768 156 361981137 287 689619251 217 765677892 124 51435599 223 881243986 64 867724270 186 762994727 8 429505599 94 980980722 276 739074276 213 646934615 40 748272219 233 939640172 65 415524207 133 752367271 140 105850549 16 222419590 1...
output:
999237254 1997568979 2995779184 3993718709 4991408649 5989065948 6986701941 7983931202 8980934393 9977706287 10974249695 11970266636 12965559260 13960713809 14955223995 15949479353 16943561874 17937049404 18929777437 19921674417 20913512189 21904864311 22896152931 23887283718 24878392517 25869308722...
result:
ok single line: '999237254 1997568979 299577918... 14079887527391 14079962184253 '
Test #11:
score: 0
Accepted
time: 113ms
memory: 11892kb
input:
1000000 100000 17 628547370 20 770082938 14 535699393 12 632751596 15 220781756 17 581861985 10 269638092 15 992182059 17 42658615 5 169296359 3 71547992 1 302308476 12 727988950 16 815713556 13 370312219 9 998481076 14 269846832 5 751344112 3 293415464 7 468053512 14 958838547 8 589547756 13 725754...
output:
999941518 1999868413 2999778701 3999674827 4999539950 5999366232 6999174643 7998977716 8998768647 9998559568 10998344370 11998121362 12997888675 13997603482 14997289493 15996974739 16996651773 17996319312 18995983331 19995634009 20995264052 21994849046 22994429629 23994004441 24993578323 25993143211...
result:
ok single line: '999941518 1999868413 299977870... 46270282515968 46270567625300 '
Test #12:
score: 0
Accepted
time: 119ms
memory: 11924kb
input:
1000000 100000 1 203196685 17 934284059 19 300866297 14 233095054 6 54776395 10 24307480 12 313222603 4 294346018 3 115763509 12 837552635 9 413482181 18 95445751 16 272073374 12 502825585 12 271447973 2 799245859 16 143012765 20 691177896 20 791506213 15 348764962 4 106854539 15 232092520 20 131279...
output:
999889278 1999733516 2999564463 3999389004 4999117819 5998823659 6998502867 7998161440 8997819043 9997468507 10997101919 11996732258 12996341619 13995946994 14995544426 15995089909 16994624512 17994155884 18993668634 19993165543 20992647073 21992119956 22991584689 23991009535 24990397268 25989769886...
result:
ok single line: '999889278 1999733516 299956446... 46424704848152 46424990428685 '
Test #13:
score: 0
Accepted
time: 99ms
memory: 12760kb
input:
1000000 100000 298 518988015 300 227810815 298 804414582 297 598138804 300 74345488 299 931293348 299 351137588 300 2875128 297 1582843 300 87548558 298 545973219 298 82529405 300 307489106 297 662965555 300 658586957 300 770950966 298 427872002 298 826990092 297 807121824 297 382920080 300 41288716...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...4033 335904783777 335905019785 '
Test #14:
score: 0
Accepted
time: 105ms
memory: 12680kb
input:
1000000 100000 297 909200742 298 596234549 300 177546157 299 838036463 300 313416578 299 613261143 298 675936750 297 605587485 297 315387989 300 356443606 297 773294581 300 356405311 298 335469796 297 419593877 297 6312363 300 42788696 298 910197313 300 125448608 297 359007793 299 967482394 298 2003...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...2638 335897854498 335898203377 '
Test #15:
score: 0
Accepted
time: 38ms
memory: 12268kb
input:
1000000 100000 297 2 298 7 300 2 300 5 298 1 299 7 298 2 297 3 300 6 298 2 298 6 297 9 300 10 300 1 300 6 300 5 299 2 299 2 298 2 297 8 297 2 298 2 298 9 300 3 297 3 299 7 298 3 300 3 298 6 298 5 300 3 297 7 299 9 299 9 300 3 297 8 299 8 298 9 300 6 297 6 299 4 297 7 297 9 297 5 300 1 300 1 300 8 29...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 3360 3360 3360 3360 3360 3360 '
Test #16:
score: 0
Accepted
time: 41ms
memory: 12252kb
input:
1000000 100000 297 4 299 4 297 2 298 2 298 10 299 8 300 1 300 2 298 7 297 4 300 8 298 8 299 7 297 1 298 5 300 3 298 5 298 5 298 3 298 9 297 2 297 9 298 8 299 1 298 10 299 7 298 2 297 1 298 7 300 3 300 2 298 3 297 8 298 9 300 5 300 2 299 7 299 2 300 9 297 5 297 10 299 10 299 4 297 2 297 6 297 4 297 7...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 3360 3360 3360 3360 3360 3360 '
Test #17:
score: 0
Accepted
time: 65ms
memory: 11444kb
input:
1000000 100000 5 4 5 7 20 3 7 6 8 3 17 5 11 4 19 5 7 3 18 8 15 4 14 9 2 5 13 4 1 8 8 1 16 6 9 1 16 2 17 3 15 7 13 9 13 2 2 10 12 3 8 4 4 3 5 8 17 1 10 7 6 10 1 6 6 9 15 8 16 2 20 2 10 8 19 7 5 6 14 6 13 6 14 3 3 2 17 10 9 7 19 9 18 10 5 9 14 5 1 9 18 4 9 7 20 3 17 1 9 3 3 7 16 6 2 1 13 3 1 3 3 9 17 ...
output:
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 7...
result:
ok single line: '10 20 30 40 50 60 70 80 90 100...96 493899 493902 493905 493908 '
Test #18:
score: 0
Accepted
time: 60ms
memory: 11492kb
input:
1000000 100000 14 1 1 1 6 7 13 10 20 5 10 10 17 2 12 10 15 9 15 4 13 4 20 4 2 5 6 9 9 2 20 7 18 2 11 5 5 5 8 10 17 8 10 10 9 3 5 2 9 8 20 2 12 4 17 4 2 5 13 1 16 3 16 1 19 4 20 10 12 1 18 9 15 8 4 1 17 8 1 6 11 4 8 7 10 7 10 3 9 10 5 8 12 1 11 3 18 4 13 5 13 2 19 6 10 10 12 4 2 9 19 1 6 6 5 4 2 7 19...
output:
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 7...
result:
ok single line: '10 20 30 40 50 60 70 80 90 100...85 494888 494891 494894 494897 '
Test #19:
score: 0
Accepted
time: 368ms
memory: 14672kb
input:
1000000 100000 1 19 1 9 1 27 1 12 1 27 1 8 1 1 1 26 1 12 1 25 1 2 1 24 1 20 1 15 1 25 1 1 1 6 1 17 1 2 1 10 1 6 1 14 1 7 1 25 1 12 1 11 1 1 1 16 1 5 1 27 1 27 1 2 1 15 1 15 1 24 1 21 1 11 1 8 1 25 1 5 1 20 1 7 1 5 1 7 1 20 1 27 1 26 1 24 1 8 1 4 1 18 1 15 1 22 1 19 1 11 1 9 1 23 1 26 1 30 1 7 1 14 1...
output:
30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990 1020 1050 1080 1110 1140 1170 1200 1230 1260 1290 1320 1350 1380 1410 1440 1470 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980 2010 2...
result:
ok single line: '30 60 90 120 150 180 210 240 2...787540 1787550 1787560 1787570 '
Test #20:
score: 0
Accepted
time: 356ms
memory: 14684kb
input:
1000000 100000 1 23 1 16 1 28 1 16 1 10 1 29 1 2 1 19 1 17 1 10 1 25 1 30 1 12 1 14 1 4 1 30 1 3 1 16 1 19 1 26 1 27 1 10 1 13 1 6 1 13 1 12 1 25 1 18 1 29 1 24 1 3 1 28 1 26 1 19 1 22 1 25 1 30 1 12 1 2 1 7 1 28 1 19 1 4 1 27 1 25 1 28 1 28 1 29 1 15 1 6 1 3 1 24 1 28 1 7 1 10 1 13 1 29 1 25 1 16 1...
output:
30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990 1020 1050 1080 1110 1140 1170 1200 1230 1260 1290 1320 1350 1380 1410 1440 1470 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980 2010 2...
result:
ok single line: '30 60 90 120 150 180 210 240 2...791223 1791233 1791243 1791253 '
Test #21:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
300 299 300 1 300 3 300 1 300 2 300 2 300 1 300 1 300 1 300 1 300 1 300 1 300 3 300 1 300 3 300 3 300 1 300 2 300 1 300 2 300 3 300 1 300 3 300 2 300 2 300 1 300 2 300 3 300 1 300 3 300 1 300 1 300 1 300 2 300 1 300 2 300 3 300 2 300 1 300 3 300 2 300 3 300 3 300 3 300 2 300 2 300 2 300 2 300 3 300 ...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #22:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
300 300 300 1 300 3 300 1 300 2 300 2 300 1 300 1 300 1 300 1 300 1 300 1 300 3 300 1 300 3 300 3 300 1 300 2 300 1 300 2 300 3 300 1 300 3 300 2 300 2 300 1 300 2 300 3 300 1 300 3 300 1 300 1 300 1 300 2 300 1 300 2 300 3 300 2 300 1 300 3 300 2 300 3 300 3 300 3 300 2 300 2 300 2 300 2 300 3 300 ...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 '
Test #23:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
300 301 300 1 300 3 300 1 300 2 300 2 300 1 300 1 300 1 300 1 300 1 300 1 300 3 300 1 300 3 300 3 300 1 300 2 300 1 300 2 300 3 300 1 300 3 300 2 300 2 300 1 300 2 300 3 300 1 300 3 300 1 300 1 300 1 300 2 300 1 300 2 300 3 300 2 300 1 300 3 300 2 300 3 300 3 300 3 300 2 300 2 300 2 300 2 300 3 300 ...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 '
Test #24:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1 1 1 1
output:
1
result:
ok single line: '1 '
Test #25:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1 1 2 1
output:
0
result:
ok single line: '0 '
Test #26:
score: 0
Accepted
time: 39ms
memory: 18668kb
input:
1000000 100000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000...
output:
1000000000 2000000000 3000000000 4000000000 5000000000 6000000000 7000000000 8000000000 9000000000 10000000000 11000000000 12000000000 13000000000 14000000000 15000000000 16000000000 17000000000 18000000000 19000000000 20000000000 21000000000 22000000000 23000000000 24000000000 25000000000 260000000...
result:
ok single line: '1000000000 2000000000 30000000...99999000000000 100000000000000 '
Test #27:
score: 0
Accepted
time: 43ms
memory: 17976kb
input:
1000000 100000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000 2 1000000000...
output:
0 1000000000 1000000000 2000000000 2000000000 3000000000 3000000000 4000000000 4000000000 5000000000 5000000000 6000000000 6000000000 7000000000 7000000000 8000000000 8000000000 9000000000 9000000000 10000000000 10000000000 11000000000 11000000000 12000000000 12000000000 13000000000 13000000000 1400...
result:
ok single line: '0 1000000000 1000000000 200000... 49999000000000 50000000000000 '
Test #28:
score: 0
Accepted
time: 37ms
memory: 17844kb
input:
1000000 100000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000 3 1000000000...
output:
0 0 1000000000 1000000000 1000000000 2000000000 2000000000 2000000000 3000000000 3000000000 3000000000 4000000000 4000000000 4000000000 5000000000 5000000000 5000000000 6000000000 6000000000 6000000000 7000000000 7000000000 7000000000 8000000000 8000000000 8000000000 9000000000 9000000000 9000000000...
result:
ok single line: '0 0 1000000000 1000000000 1000... 33333000000000 33333000000000 '
Test #29:
score: 0
Accepted
time: 2ms
memory: 4732kb
input:
1 100000 1 1
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok single line: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 '