QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#343018 | #1820. Contest Construction | LaStataleBlue# | AC ✓ | 1ms | 4316kb | C++23 | 1.5kb | 2024-03-01 21:03:20 | 2024-03-01 21:03:21 |
Judging History
answer
#pragma ide diagnostic ignored "misc-no-recursion"
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef double db;
typedef complex<db> pt;
#define TESTCASE 0
static constexpr int MOD = 998'244'353;
static constexpr int INF = 1.1e9;
static constexpr int MAXN = 64;
static ll dp[MAXN][MAXN][MAXN];
static void solve([[maybe_unused]] int tc) {
int N, K;
cin >> N >> K;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
sort(A.begin(), A.end());
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
dp[2][i][j] = 1;
}
}
for (int z = 3; z <= K; z++) {
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
for (int k = j + 1; k < N; k++) {
if (A[i] + A[j] >= A[k]) {
dp[z][j][k] += dp[z - 1][i][j];
}
}
}
}
}
ll res = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
res += dp[K][i][j];
}
}
cout << res << endl;
}
int main() {
ios::sync_with_stdio(false);
if (const char *f = getenv("REDIRECT_STDOUT"); f) {
freopen(f, "w", stdout);
}
int T = 1;
#if TESTCASE
cin >> T;
#endif
for (int t = 1; t <= T; t++) {
solve(t);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3832kb
input:
5 4 2 1 4 3 5
output:
4
result:
ok answer is '4'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
8 5 1 2 3 5 8 13 21 34
output:
4
result:
ok answer is '4'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3972kb
input:
50 18 543 654 76 654 45 89879 5465 52534 65 76 987 54 342 76 897 98 78 765 653 763 532 654 543 432 653 754 876 9786 653 836 346 76 235 765 2543 765 443 76 7654 25 65 765 543 543 7654 54 3 76 43 54
output:
10783193
result:
ok answer is '10783193'
Test #4:
score: 0
Accepted
time: 1ms
memory: 4112kb
input:
50 18 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19
output:
18053528883775
result:
ok answer is '18053528883775'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
50 3 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19
output:
19600
result:
ok answer is '19600'
Test #6:
score: 0
Accepted
time: 1ms
memory: 4012kb
input:
50 18 7295433 4122373 116406027 454116124 42443372 317888 199216502 56260397 610004 13392063 283357040 508349280 89413497 70331028 368879117 111784767 4593692 29343700 23021361 279434982 22390765 45945161 286368123 209208600 21877989 548877618 4162222 137007556 167875908 146173950 313180214 30870818...
output:
144239641210
result:
ok answer is '144239641210'
Test #7:
score: 0
Accepted
time: 1ms
memory: 4020kb
input:
50 18 3716814 568135643 462160899 26805431 231695644 5601526 502786118 39783184 35426663 186422202 62425419 101059185 665437020 635618232 51542527 396465857 16859236 7425591 6756174 19816493 304091886 215495907 171198606 106533934 23764675 163466813 4479298 44408003 7645949 15198717 73536966 1483222...
output:
596113488536
result:
ok answer is '596113488536'
Test #8:
score: 0
Accepted
time: 1ms
memory: 4016kb
input:
50 18 283024896 152603423 11426132 234806568 34524227 18658291 542799424 62907242 116203436 25415293 123271745 372299577 4660528 8132023 11257429 7023013 5723335 126878926 37145542 128854220 87434920 58277670 220888000 204051291 43385646 34364783 14491819 3583887 422452342 352166988 22274761 2998060...
output:
650569073161
result:
ok answer is '650569073161'
Test #9:
score: 0
Accepted
time: 1ms
memory: 4316kb
input:
50 18 518983379 161261581 233740320 63990718 1161766 19769681 214374511 267851575 31916563 917480 71355983 71438920 6667292 21529994 20838999 37065074 2361475 502996567 16266200 164062179 16079469 6910382 4115517 11504084 7028100 310973025 123304215 136428223 234122549 18130324 21790647 54624354 726...
output:
523676516787
result:
ok answer is '523676516787'
Test #10:
score: 0
Accepted
time: 1ms
memory: 4072kb
input:
50 18 57666270 1159218 336251104 129466393 2004008 84645694 222646363 35751 16858266 216878243 55993065 80539635 55452100 70464080 143170709 131663398 120164194 382468753 48877550 338314052 66682226 63657147 22053549 126138315 897932414 4831119 11516705 14487645 37734172 149495136 11756744 127004803...
output:
144283310470
result:
ok answer is '144283310470'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
50 4 160895411 133753403 24170951 340889608 103160738 1245670 529012 14206884 10024066 2277830 253132949 33201663 301074895 13233668 255259851 82136942 75303474 141124335 51809216 78139988 148798277 31992136 7980940 183241772 117326858 21895456 92419 146958913 54038400 162803585 472892287 1718076 41...
output:
18594
result:
ok answer is '18594'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
50 5 4714560 73523659 297216094 523617033 15650792 45996997 38959045 23006547 225213776 4282851 98141570 239793683 124440915 47821779 28479221 476587361 102861573 13504383 309724799 50677850 33789624 69478648 12882520 313306636 23164396 41780840 32218332 239401178 29691399 81969108 9642447 6812843 7...
output:
142332
result:
ok answer is '142332'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3996kb
input:
50 7 7212185 89967209 118736951 67603391 206951937 11662438 176579927 75912703 151673308 79102167 87582067 224089353 50919992 508344372 31664598 12189945 123288192 5654969 19508263 459423221 44982500 102586884 140960833 308378815 216407698 112679266 116410233 59227074 20686731 198668231 517153234 13...
output:
11005572
result:
ok answer is '11005572'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
50 5 78992558 20900606 547083083 66174583 45321166 62884504 119031713 64231289 19363623 90983177 164563975 3113683 174993272 129275214 474853111 110377017 504518112 263472888 74742274 178769089 72661056 22713406 160180628 40627740 2462697 3343269 63549971 22592341 427599504 6574851 15760803 734586 2...
output:
63503
result:
ok answer is '63503'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
50 12 102938510 142012747 380065 179164691 737717892 251937304 295610346 21314 5882257 20485156 5730920 146970036 19642097 424955645 163906140 16742316 12009421 374643689 95856978 18877704 438324875 194527107 2619322 19371194 68818096 433606 404928525 19767487 26831020 23851623 105828223 86974448 36...
output:
596655843
result:
ok answer is '596655843'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
41 17 25215838 9249186 10565052 77917863 66649914 37670464 38367976 39156515 72271688 82569137 215409505 37199653 128955494 12980702 139996410 6211992 1167092 291725158 242352776 76786184 95399187 217359406 241534470 731288594 8398269 69683265 246895523 26419611 170319625 100681488 397712972 4552682...
output:
5732675960
result:
ok answer is '5732675960'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
50 13 61931407 341704599 171884663 309716000 38860051 1909972 208959832 79620359 125005624 2027588 4220857 62570080 7896576 4508976 149359230 67835433 79198912 69109400 19133269 280408739 3217911 1314057 24768376 43347299 1052972 64246656 10744844 688158546 15249889 12078768 6814665 9939048 40186916...
output:
295639415
result:
ok answer is '295639415'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
12 9 427611936 87433585 6351505 10445202 79533273 345081318 21730411 107753046 9034515 55516354 33528234 615757
output:
0
result:
ok answer is '0'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
19 16 227041629 154098404 254470885 6902171 238443211 147821630 183625244 71117051 182312095 52163318 13847176 198545690 331731449 154695040 91974598 207538517 116381815 149148831 131636954
output:
17
result:
ok answer is '17'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3984kb
input:
37 8 66233394 216889 26334716 188509248 19471604 74838914 19177057 122552044 18784075 21016552 125399695 36611533 227708120 8089590 31944730 225208809 190115174 41547203 247710457 7824707 65542628 108764859 52971101 19190856 25601368 228598252 155293782 93252132 146375633 97492451 25105673 289792622...
output:
2545587
result:
ok answer is '2545587'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
42 18 1 2 4 7 12 20 33 54 88 143 232 376 609 986 1596 2583 4180 6764 10945 17710 28656 46367 75024 121392 196417 317810 514228 832039 1346268 2178308 3524577 5702886 9227464 14930351 24157816 39088168 63245985 102334154 165580140 267914295 433494436 701408732
output:
0
result:
ok answer is '0'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
3 3 1 10 100
output:
0
result:
ok answer is '0'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
3 3 1 2 3
output:
1
result:
ok answer is '1'