QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#812249 | #64. Naan | guleng2007# | 29 | 112ms | 70188kb | C++23 | 1.4kb | 2024-12-13 13:23:29 | 2024-12-13 13:23:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=2005;
int a[N][N];
struct fraction
{
int a,b;
fraction operator +(const fraction& oth) const
{
return (fraction){a*oth.b+b*oth.a,b*oth.b};
}
fraction operator -(const fraction& oth) const
{
return (fraction){a*oth.b-b*oth.a,b*oth.b};
}
fraction operator *(const fraction& oth) const
{
return (fraction){a*oth.a,b*oth.b};
}
fraction operator /(const fraction& oth) const
{
return (fraction){a*oth.b,b*oth.a};
}
bool operator <=(const fraction& oth) const
{
return a*oth.b<=b*oth.a;
}
};
fraction p[N][N];
bool vis[N];
int ans[N];
signed main()
{
int n,l;
cin >> n >> l;
for(int i=1;i<=n;i++)
for(int j=1;j<=l;j++)
scanf("%lld",&a[i][j]);
for(int i=1;i<=n;i++)
{
int sum=0;
for(int j=1;j<=l;j++)
sum += a[i][j];
int pos=0, tot=0;
for(int k=1;k<n;k++)
{
while((fraction){tot+a[i][pos+1],1}<=(fraction){sum*k,n})
tot += a[i][pos+1], pos++;
p[i][k]=((fraction){sum*k,n}-(fraction){tot,1})/(fraction){a[i][pos+1],1}+(fraction){pos,1};
}
}
for(int i=1;i<=n;i++)
{
int best=0;
for(int j=1;j<=n;j++)
if(!vis[j] && (!best || p[j][i]<=p[best][i]))
best=j;
ans[i]=best, vis[best]=true;
}
for(int i=1;i<n;i++)
printf("%lld %lld\n",p[ans[i]][i].a,p[ans[i]][i].b);
for(int i=1;i<=n;i++)
printf("%d ",ans[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 5812kb
input:
2 1516 42058 25892 51128 40494 78380 30332 47660 58339 90812 50469 28184 75581 61837 25051 90975 98279 81022 90217 31015 72984 89884 68399 47215 10071 43418 61089 91302 96661 47701 86531 26050 80503 54870 1405 71971 39883 82485 66816 115 49358 86761 24392 32521 87048 19107 56752 23862 96755 80318 44...
output:
118534088 158076 2 1
result:
ok good plan
Test #2:
score: 5
Accepted
time: 1ms
memory: 5848kb
input:
2 1695 76378 25507 49544 44950 65160 78873 9386 2835 83577 43277 76229 211 44539 72155 22877 94528 90143 3059 2545 54142 93915 38121 21660 42212 2905 22170 43789 49582 23309 23087 21879 45961 28979 2149 83758 55646 64230 18591 99255 85995 12089 33270 72149 71120 93645 42211 83004 67031 30337 58759 8...
output:
92106216 108896 1 2
result:
ok good plan
Test #3:
score: 5
Accepted
time: 1ms
memory: 5868kb
input:
2 1896 5656 8488 83550 73597 66974 30814 60595 60681 58121 15839 43067 39354 72302 99482 94940 54418 44486 26825 3593 2745 46490 31847 38002 89179 52576 56052 23613 2386 32515 13670 51023 99869 67448 18185 89358 79676 73441 90660 76289 78975 35379 98098 96191 16119 75401 71516 46141 53036 49002 9248...
output:
131353113 140046 1 2
result:
ok good plan
Test #4:
score: 5
Accepted
time: 0ms
memory: 5920kb
input:
2 1089 5 4 5 1 5 3 2 4 5 5 1 3 3 1 2 5 4 1 5 5 5 3 1 2 2 2 1 5 2 92110 1 3 2 4 1 1 1 5 2 4 2 3 4 5 2 1 5 3 68199 92895 2 3 2 2 4 3 4 5 2 21113 2 3 2 3 4 2 3 2 3 5 1 2 4 3 4 2 2 4 3 1 5 1 3 2 2 3 3 5 1 2 5 4 5 4 5 2 3 2 5 3 1 1 4 1 3 1 3 4 3 3 2 1 5 3 4 4 5 4 4 4 5 2 5 1 5 4 2 2 3 1 4 1 2 31268 5 1 5...
output:
48326578 108462 2 1
result:
ok good plan
Test #5:
score: 5
Accepted
time: 1ms
memory: 7884kb
input:
2 207 2 4 5 2 5 5 4 3 53669 1 3 3 2 4 4 5 3 5 4 4 3 2 4 2 4 3 50596 5 4 4 1 5 2 3 5 4 3 2 5 4 5 1 5 5 1 3 4633 2 1 53463 3 5 5 4 4 2 2 5 2 74695 2 55853 90432 5 5 4 1 1 3 2 5 1 2 3 4 2 5 2 1819 1 5 5 1 4 1 3 3 1 4 1 3 3 33131 1 4 4 3 1 1 3 4 2 3 5934 2 3 2 1 1 3 24906 4 1 5 5 4 2 3 2 2 5 2 1 5 1 1 5...
output:
4476566 60118 2 1
result:
ok good plan
Test #6:
score: 5
Accepted
time: 1ms
memory: 5868kb
input:
2 1484 79520 5 2 1 4 2 4 4 1 5 3 5 1 3 2 3 4 5 2 1 5 5 5 5 3 5 3 1 2 2 4 5 2 4 1 4 5 4 5 29879 36119 5 14571 1 5 5 3 3 2 4 4 5 31580 1 1 1 4 5 4 3 1 4 3 2 5 2 3 1 2 4 4 3 2 35480 1 5 4 4 1 2 2 5 5 2 3 3 4 1 1 4 1 4 5 4 1 1 1 4856 4 3 5 5 5 5 3 3 5571 91607 3273 3 1 4 2 5 63040 5 2 1 3 2 1 2 99930 4 ...
output:
99452768 165386 1 2
result:
ok good plan
Test #7:
score: 5
Accepted
time: 1ms
memory: 5844kb
input:
2 1644 5 2 4 2 2 3 1 4 3 4 1 4 4 5 1 2 5 2 2 3 1 5 3 1 4 5 5 4 2 5 2 4 5 4 3 5 4 5 2 5 1 3 1 5 2 5 3 2 5 3 5 3 4 3 5 2 5 2 69823 3 4 1 2 2 1 4 1 4 5 4 4 2 2 5 5 5 5 4 4 5 4 2 4 5 3 5 1 5 4 5 4 4 5 3 5 2 2 5 5 1 2 1 2 3 4 3 2 5 3 4 3 3 1 1 4 4 1 3 3 2 2 4 3 2 1 1 5 3 4 1 3 2 2 1 4 5 1 5 4 5 5 5 5 1 5...
output:
8173901 139646 1 2
result:
ok good plan
Test #8:
score: 5
Accepted
time: 0ms
memory: 5852kb
input:
2 302 5 3 1 1 1 2 1 2 2 3 5 4 3 3 3 2 2 1 2 5 1 3 4 5 2 2 2 2 3 5 5 5 1 1 4 5 3 3 1 2 5 5 5 5 2 1 1 3 4 5 4 4 4 3 3 1 4 2 5 4 2 1 2 4 4 1 1 3 3 2 2 4 1 2 3 5 4 5 3 2 2 5 4 2 1 3 4 3 2 4 5 2 1 2 3 4 1 4 4 3 2 5 2 5 2 2 4 2 5 3 1 2 3 4 5 1 2 2 5 1 1 1 2 5 5 4 5 5 2 1 5 4 1 4 2 2 2 1 1 2 2 5 1 5 2 2 5 ...
output:
24245040 88650 1 2
result:
ok good plan
Test #9:
score: 5
Accepted
time: 0ms
memory: 5924kb
input:
2 1925 4 2 4 4 3 1 3 5 4 5 3 4 5 4 2 4 2 2 4 3 5 3 2 4 1 4 2 5 5 3 5 3 2 2 4 5 5 3 2 4 3 4 3 5 3 3 3 2 2 1 2 2 5 4 1 5 3 3 3 5 1 5 2 1 3 3 4 1 2 1 3 2 1 5 4 5 4 5 5 5 4 5 2 1 1 3 2 4 4 2 2 4 3 4 1 2 5 1 4 3 4 5 3 1 1 1 2 4 1 1 1 3 2 5 3 3 5 4 4 3 3 4 4 4 3 4 1 2 5 2 4 1 4 5 3 1 4 1 4 4 4 3 3 1 3 1 3...
output:
10770755 54790 1 2
result:
ok good plan
Test #10:
score: 5
Accepted
time: 1ms
memory: 7904kb
input:
2 1800 19199 26563 12624 27089 2367 1315 38661 2893 38135 29193 24722 6049 22355 1578 9731 9994 33401 6312 29193 15780 34190 26037 30245 12361 1578 28404 13939 17621 22618 31560 17884 21303 10783 30508 30245 19199 17621 35768 23407 526 34979 19988 25774 9205 8153 30245 38135 17358 4734 17358 16306 2...
output:
55875599 61256 2 1
result:
ok good plan
Test #11:
score: 5
Accepted
time: 1ms
memory: 5928kb
input:
2 2000 4192 45064 45850 23842 8384 20436 262 26986 64190 68120 59212 39038 58688 62356 62880 29344 50304 21222 3930 53186 47160 40610 9170 37990 20960 3930 50042 28820 30916 42968 9170 25938 9432 55020 8384 59474 1572 32226 54758 39562 4716 45326 46898 8646 29606 29606 40086 36156 42706 55544 30916 ...
output:
41865208 41360 2 1
result:
ok good plan
Test #12:
score: 5
Accepted
time: 1ms
memory: 6004kb
input:
2 1998 56448 17024 54656 74816 41216 22848 70784 12544 46592 51968 37184 41664 35392 25984 10304 11648 41216 62720 36736 80192 37632 65856 57344 48832 44800 17920 13440 4480 42560 68992 8512 21952 67200 50176 73024 7616 17920 45696 44352 68096 14336 38976 35392 50624 53312 50176 33152 67648 76160 41...
output:
21926920 22320 2 1
result:
ok good plan
Test #13:
score: 5
Accepted
time: 1ms
memory: 6004kb
input:
2 1995 49236 61172 13055 80941 18650 50755 87982 10487 42890 46618 76856 55914 48870 3733 54114 85027 54442 60053 62664 71616 83179 20142 70497 11936 1119 68645 15657 63767 69757 50361 59307 53712 89147 84666 61548 54433 65309 42865 65671 28348 15293 76838 10071 3357 28721 91385 9698 41023 70504 443...
output:
4574282 4554 2 1
result:
ok good plan
Test #14:
score: 5
Accepted
time: 1ms
memory: 5936kb
input:
2 2000 16800 49200 83600 75200 26106 56355 35939 5600 73609 72391 4400 78000 80000 83600 27200 30000 78800 65200 30800 11200 22000 52400 8800 65200 33200 12800 64370 70830 36400 3600 34400 51200 72333 16867 46800 57600 38000 38000 18400 11154 24046 79200 24400 55200 58800 26458 75542 79200 6400 4760...
output:
26281073 26208 2 1
result:
ok good plan
Subtask #2:
score: 24
Accepted
Test #15:
score: 24
Accepted
time: 1ms
memory: 5924kb
input:
2 1168 4 10 7 6 10 3 9 5 7 10 9 7 9 1 5 9 8 5 3 4 5 2 10 7 6 2 4 5 2 4 4 8 10 1 2 9 1 3 6 6 3 8 8 1 8 4 5 6 7 9 2 2 3 2 8 9 4 7 8 9 8 6 8 4 6 3 5 4 5 1 5 5 10 8 2 4 8 1 9 1 7 6 10 4 4 2 3 4 6 3 2 9 1 10 3 8 8 10 8 1 8 10 8 6 1 1 3 8 2 6 8 6 8 9 8 1 7 6 9 3 2 1 5 2 8 6 4 4 1 2 9 2 6 6 8 2 4 2 2 4 6 4...
output:
5696 10 2 1
result:
ok good plan
Test #16:
score: 24
Accepted
time: 1ms
memory: 7964kb
input:
4 1194 4 10 8 8 5 9 8 6 2 5 10 6 4 7 2 4 8 5 4 10 6 5 1 6 5 3 10 7 6 9 4 10 7 4 5 10 7 1 9 5 3 5 3 7 7 5 5 4 7 9 1 7 9 10 8 10 7 9 8 3 8 7 6 3 10 9 8 3 2 2 4 4 8 4 10 1 4 9 6 7 9 7 2 1 10 5 6 2 6 4 2 7 7 7 9 10 9 1 6 7 9 6 5 3 3 9 1 8 10 1 2 3 9 9 10 7 6 5 6 8 3 10 2 10 5 1 2 7 10 1 1 4 8 2 5 3 1 2 ...
output:
5796 20 21354 36 17818 20 1 4 3 2
result:
ok good plan
Test #17:
score: 24
Accepted
time: 0ms
memory: 5960kb
input:
6 1087 5 2 10 1 6 4 9 2 4 4 3 1 5 1 6 1 4 5 10 1 2 8 1 10 6 3 9 8 4 9 3 7 6 9 4 4 8 6 7 7 7 9 5 7 4 1 8 2 9 10 7 2 4 4 1 5 6 4 2 1 7 1 4 3 6 8 10 7 10 10 7 3 5 2 10 5 8 1 2 2 3 4 3 5 5 2 1 4 1 5 1 6 1 7 5 10 3 5 8 4 4 7 10 9 5 8 7 4 3 1 9 1 6 6 2 7 10 8 4 2 10 6 7 9 4 1 2 7 4 9 8 10 7 4 8 1 6 9 6 2 ...
output:
7311 42 19280 54 9783 18 26158 36 54589 60 2 5 1 6 4 3
result:
ok good plan
Test #18:
score: 24
Accepted
time: 1ms
memory: 5952kb
input:
6 1548 2 10 5 8 1 2 10 9 1 5 5 3 2 4 2 2 9 4 3 4 2 10 6 7 10 2 6 5 8 7 5 2 6 8 10 5 6 9 5 5 8 9 8 10 2 6 1 10 3 6 7 5 5 5 6 7 8 5 5 2 1 4 10 5 2 5 8 9 4 7 1 9 4 2 3 9 9 3 10 3 1 1 2 8 6 10 3 2 9 5 5 8 1 1 1 4 1 6 5 4 3 5 8 10 10 1 7 8 10 6 3 5 10 2 6 4 4 1 5 6 9 10 4 3 2 6 8 7 5 10 10 10 4 7 1 7 3 6...
output:
14987 60 12186 24 41517 54 36706 36 61843 48 6 3 2 4 5 1
result:
ok good plan
Test #19:
score: 24
Accepted
time: 1ms
memory: 5892kb
input:
6 1222 9 4 8 4 7 7 1 8 2 6 9 7 8 3 5 2 5 2 10 3 7 6 5 9 7 8 2 2 1 8 6 1 5 6 5 7 10 4 7 8 9 5 6 8 7 8 6 3 7 6 7 5 6 8 4 4 2 5 2 7 2 4 5 10 3 6 6 7 10 6 1 3 2 8 10 5 6 3 7 3 7 4 7 10 10 8 3 6 5 6 9 10 3 6 10 5 5 2 1 7 3 8 8 5 2 9 5 6 4 5 6 8 5 6 9 1 2 10 4 2 10 10 1 9 5 3 6 8 6 5 1 5 1 4 10 10 10 4 5 ...
output:
2338 12 19080 48 33222 54 48918 60 61262 60 6 1 4 2 3 5
result:
ok good plan
Test #20:
score: 24
Accepted
time: 1ms
memory: 5828kb
input:
4 1157 3 2 4 4 4 1 4 1 3 3 3 5 3 5 3 3 6 2 3 2 2 4 2 2 5 1 5 1 5 1 5 2 2 3 1 2 4 2 5 5 2 2 2 2 1 5 3 4 1 5 3 3 2 3 5 4 4 4 5 4 1 3 4 2 3 1 3 5 5 3 4 4 5 4 5 4 2 1 4 1 1 4 2 4 3 4 1 5 5 4 1 4 3 2 3 4 5 3 3 1 3 5 4 5 1 2 3 1 4 5 5 4 2 5 2 2 2 3 5 3 2 2 5 4 5 4 3 1 4 3 2 1 2 1 2 6 4 2 1 3 4 5 4 2 5 1 3...
output:
2262 8 18202 32 17324 20 1 4 3 2
result:
ok good plan
Test #21:
score: 24
Accepted
time: 1ms
memory: 6004kb
input:
2 1248 2 4 3 5 4 2 4 1 3 2 5 5 4 5 3 2 4 2 4 4 4 2 1 3 4 1 3 5 3 2 2 4 4 1 4 1 3 9 5 1 4 4 3 1 1 5 8 5 1 10 5 5 5 2 4 1 6 2 5 4 1 4 3 4 1 1 4 2 1 5 9 4 4 1 1 5 3 5 4 2 5 2 3 4 1 2 2 1 5 2 5 1 4 5 4 4 4 1 2 4 5 4 2 5 4 1 10 3 2 5 3 2 2 3 5 3 5 1 3 2 3 3 1 5 5 4 3 5 4 2 2 2 2 5 4 1 2 5 5 2 5 3 2 4 7 4...
output:
3736 6 2 1
result:
ok good plan
Test #22:
score: 24
Accepted
time: 1ms
memory: 7992kb
input:
6 474 3 3 2 2 2 5 5 5 3 1 4 2 5 3 5 5 1 5 3 2 5 3 5 3 2 1 1 1 3 5 4 1 4 5 1 3 3 2 4 1 3 3 1 2 2 5 1 5 5 3 7 5 4 10 5 2 5 1 5 2 4 5 1 1 5 4 3 3 5 1 5 1 1 4 3 5 1 2 7 4 4 4 4 2 3 5 5 1 2 5 4 3 4 3 1 3 9 5 2 1 3 2 5 5 4 5 3 2 3 4 5 3 8 2 3 3 4 5 5 3 5 1 3 4 4 3 3 5 2 5 5 1 2 1 5 7 1 4 1 4 5 2 1 4 4 3 3...
output:
1301 18 2630 18 4080 18 3660 12 11759 30 6 1 4 3 2 5
result:
ok good plan
Test #23:
score: 24
Accepted
time: 1ms
memory: 5832kb
input:
6 1782 1 4 5 2 3 3 3 5 3 5 3 5 1 4 2 5 3 3 3 3 1 3 1 1 5 2 3 1 1 4 4 2 3 7 1 1 2 5 5 2 3 4 4 3 2 5 2 4 4 3 2 2 3 5 2 5 3 1 2 2 4 4 2 1 2 2 1 2 4 1 4 3 3 2 4 5 1 5 1 2 5 3 3 4 3 1 9 5 3 5 5 2 2 2 1 5 3 5 2 5 2 1 5 2 2 5 5 2 1 3 4 2 2 2 4 2 5 4 2 4 5 1 1 2 5 2 1 2 2 5 2 5 3 1 4 4 4 2 3 3 1 2 2 2 4 2 5...
output:
8492 30 10346 18 5262 6 35566 30 8934 6 4 3 2 5 1 6
result:
ok good plan
Test #24:
score: 24
Accepted
time: 1ms
memory: 5940kb
input:
6 1695 4 5 5 7 3 4 1 5 2 4 1 5 1 3 1 2 4 4 5 5 5 5 4 5 3 3 2 3 3 5 5 4 5 2 5 2 3 4 1 2 2 3 1 3 3 1 2 5 3 2 3 3 5 2 5 4 5 8 5 2 5 2 3 5 2 1 4 4 2 4 2 5 1 5 2 3 5 3 2 3 2 1 5 4 4 2 1 1 3 2 3 3 3 3 4 2 1 5 3 3 1 4 2 2 4 4 2 4 2 1 5 1 2 5 4 1 2 1 5 1 5 4 1 1 1 5 1 3 3 4 4 5 3 2 1 5 3 3 1 4 4 2 3 2 10 2 ...
output:
3303 12 10042 18 10098 12 26832 24 33500 24 6 5 2 3 1 4
result:
ok good plan
Test #25:
score: 24
Accepted
time: 1ms
memory: 5996kb
input:
6 1095 5 1 5 2 5 4 1 1 3 4 3 3 2 5 2 3 3 2 2 2 5 1 3 9 2 2 1 2 3 3 2 2 2 2 2 2 5 3 2 2 2 2 2 1 4 1 1 5 2 1 8 1 5 3 2 5 3 2 3 4 4 1 1 3 3 5 5 3 5 1 4 2 3 2 3 5 2 3 3 4 2 2 3 5 2 1 5 4 1 1 3 3 3 1 3 1 4 1 3 3 8 5 4 5 4 1 1 1 1 4 2 3 1 1 2 3 4 2 1 4 2 2 3 1 2 4 1 3 3 5 4 2 4 4 2 2 5 3 5 4 3 5 4 1 1 5 5...
output:
5119 30 10864 30 16560 30 13208 18 27377 30 4 3 5 6 2 1
result:
ok good plan
Test #26:
score: 24
Accepted
time: 1ms
memory: 5860kb
input:
4 61 1 3 3 5 2 4 3 2 3 5 4 4 1 5 5 5 3 4 5 5 1 5 5 4 2 2 1 5 2 2 2 1 2 4 4 5 5 3 2 2 1 1 5 2 1 5 5 2 3 4 5 4 1 1 5 1 1 5 1 1 4 2 2 5 4 1 1 4 4 2 1 1 2 1 2 3 3 3 5 4 1 4 1 1 5 5 2 4 5 4 4 5 1 4 4 1 2 5 4 1 4 5 4 2 3 2 4 2 4 3 1 5 4 1 4 5 3 2 10 5 3 3 1 5 3 2 1 1 5 3 3 5 4 3 1 4 4 5 4 2 5 2 1 4 2 2 3 ...
output:
289 20 456 16 580 12 1 4 2 3
result:
ok good plan
Test #27:
score: 24
Accepted
time: 1ms
memory: 5940kb
input:
4 1361 3 4 1 5 5 2 1 2 2 2 4 1 5 3 4 2 3 4 5 2 1 1 3 5 1 2 1 1 1 2 4 5 4 5 4 3 4 5 3 1 2 2 2 2 2 2 5 5 3 1 1 4 2 2 5 4 4 5 3 5 5 4 1 4 1 3 2 4 4 2 4 5 5 3 4 4 5 1 4 3 4 1 3 2 4 1 1 3 3 2 2 3 5 5 3 4 4 4 1 2 4 2 2 1 5 2 4 2 2 5 3 5 3 3 2 2 5 2 5 5 5 5 3 2 2 2 1 3 5 4 4 4 2 2 3 2 4 3 2 4 4 1 1 1 4 1 1...
output:
4023 12 13494 20 8193 8 1 2 3 4
result:
ok good plan
Test #28:
score: 24
Accepted
time: 0ms
memory: 5992kb
input:
6 1703 1 5 2 5 2 1 5 5 2 2 2 2 3 5 4 2 4 2 4 2 5 2 1 3 1 4 1 5 4 1 5 2 2 3 5 2 4 4 5 5 5 5 4 1 1 3 2 2 4 1 1 3 3 3 4 4 5 3 5 4 1 1 2 1 4 3 4 2 2 1 1 2 3 2 1 3 1 3 2 5 2 2 1 2 3 2 2 4 4 1 2 2 1 4 4 3 3 5 1 4 4 4 4 4 1 3 1 5 1 4 1 2 5 3 2 2 3 4 1 3 4 2 3 2 1 2 4 3 2 5 5 2 3 4 3 5 4 1 1 5 3 4 1 2 2 2 3...
output:
8503 30 6760 12 5091 6 34054 30 42731 30 6 3 1 4 5 2
result:
ok good plan
Test #29:
score: 24
Accepted
time: 1ms
memory: 5896kb
input:
6 1454 5 1 5 1 5 2 3 3 5 4 3 3 4 2 1 3 3 3 2 4 2 4 5 5 1 3 2 4 3 5 2 3 3 3 3 1 3 3 1 3 3 1 3 2 2 5 1 3 4 2 1 2 3 2 1 1 4 5 1 1 3 2 4 5 3 1 3 1 1 5 4 5 4 2 1 5 4 3 4 1 5 2 2 2 5 5 3 1 2 2 4 5 3 5 1 5 1 1 5 3 1 2 5 4 1 2 3 1 1 3 1 3 2 3 4 4 1 5 1 2 3 1 5 1 4 1 1 1 1 1 4 1 4 1 3 3 3 3 1 2 5 2 3 5 5 5 1...
output:
5598 24 13978 30 13134 18 17390 18 36293 30 2 4 6 5 1 3
result:
ok good plan
Test #30:
score: 24
Accepted
time: 1ms
memory: 5960kb
input:
6 1806 1 4 4 4 4 5 5 1 1 2 4 2 1 5 5 5 3 1 2 3 2 5 2 4 2 4 2 5 3 2 5 4 2 4 4 3 1 1 5 4 2 3 4 3 3 5 3 2 3 5 4 1 1 1 2 1 4 2 5 4 5 3 5 2 4 1 3 3 5 3 3 5 1 3 5 2 1 3 5 3 4 2 1 5 4 1 4 4 2 1 5 1 5 1 5 3 3 1 2 5 4 2 1 3 3 1 3 1 1 4 5 3 4 2 4 1 1 3 4 4 2 4 2 3 1 2 4 5 5 4 1 2 3 2 1 5 4 1 3 2 1 4 4 2 2 4 5...
output:
7100 24 3580 6 26877 30 28942 24 36004 24 4 3 5 2 6 1
result:
ok good plan
Test #31:
score: 24
Accepted
time: 0ms
memory: 5940kb
input:
6 1623 2 3 3 3 1 2 2 3 4 2 4 5 2 2 1 2 3 3 1 3 1 5 3 3 5 2 1 1 1 5 3 5 4 2 3 4 2 5 3 4 3 3 3 5 4 4 5 4 4 5 3 5 2 3 2 5 5 3 3 5 3 3 4 2 1 3 2 5 1 5 4 4 2 2 5 3 1 5 3 4 4 2 4 2 1 3 3 4 2 2 1 2 5 2 3 4 4 4 5 2 5 4 5 5 5 5 5 5 1 1 1 3 5 2 2 1 3 4 2 5 4 3 5 5 5 2 3 2 2 3 2 5 2 4 3 4 3 1 4 1 1 1 2 5 1 1 2...
output:
7756 30 12826 24 19422 24 19410 18 32390 24 3 5 2 1 6 4
result:
ok good plan
Test #32:
score: 24
Accepted
time: 1ms
memory: 5920kb
input:
6 1993 2 2 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 1 1 1 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 1 1 1 1 1 2 2 1 1 1 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 2 1 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 1 2 2 2 2 1 1 2 2 2 1 2 1 2 1 2 2 1 1...
output:
15248 48 39110 60 29640 30 15856 12 9940 6 6 5 4 3 2 1
result:
ok good plan
Test #33:
score: 24
Accepted
time: 1ms
memory: 6028kb
input:
6 2000 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6...
output:
18000 54 4000 6 6000 6 48000 36 10000 6 6 5 4 3 2 1
result:
ok good plan
Test #34:
score: 24
Accepted
time: 1ms
memory: 5940kb
input:
5 1995 7 6 1 5 2 6 3 6 6 2 7 3 2 2 10 3 3 10 3 6 5 3 7 6 8 4 6 1 8 3 1 8 4 6 7 1 3 8 4 3 9 3 10 2 3 6 3 3 6 3 6 6 3 5 6 1 3 9 3 3 2 9 8 5 4 2 3 3 3 3 3 8 4 3 3 7 8 6 7 2 4 6 2 9 6 9 3 1 1 3 9 1 4 10 1 6 6 4 2 6 3 3 3 2 3 1 6 7 8 6 6 3 8 4 2 4 9 5 1 6 3 5 8 6 2 2 3 1 3 6 3 6 3 3 6 6 5 2 7 10 3 8 6 1 ...
output:
3924 10 31696 40 17718 15 63232 40 5 4 3 2 1
result:
ok good plan
Test #35:
score: 24
Accepted
time: 1ms
memory: 5936kb
input:
6 2000 7 1 4 8 4 8 4 2 6 8 1 7 10 10 4 8 4 8 8 8 8 4 8 4 4 10 6 8 8 8 4 10 2 8 8 8 4 8 4 8 4 4 8 8 6 4 10 8 5 7 4 6 2 8 4 7 5 8 8 10 6 8 4 4 4 4 4 8 9 7 8 8 4 4 8 8 8 4 9 10 9 5 5 6 2 1 5 4 8 8 8 4 6 2 8 4 8 4 2 9 3 6 4 6 6 8 4 4 4 4 8 8 9 5 2 8 10 8 10 1 1 10 4 4 8 4 8 7 1 8 8 4 8 8 8 4 4 8 8 4 5 7...
output:
19615 60 31768 48 11898 12 72208 54 99935 60 6 5 4 3 2 1
result:
ok good plan
Test #36:
score: 24
Accepted
time: 1ms
memory: 6028kb
input:
6 2000 9 9 9 9 9 9 10 8 9 9 9 10 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 9 10 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 8 9 9 9 9 9 9 ...
output:
4000 12 28000 42 36000 36 16000 12 100002 60 6 5 4 3 1 2
result:
ok good plan
Test #37:
score: 24
Accepted
time: 1ms
memory: 5940kb
input:
3 8 1 2 1 2 2 1 2 1 2 1 2 1 1 2 1 2 2 4 4 2 2 4 2 4
output:
30 12 15 3 3 1 2
result:
ok good plan
Test #38:
score: 24
Accepted
time: 1ms
memory: 5884kb
input:
5 1843 10 2 10 6 7 5 10 6 10 9 10 2 8 6 6 3 10 10 9 8 9 4 10 4 10 6 8 10 5 8 4 10 5 10 10 10 10 10 9 9 8 3 6 7 3 10 10 10 5 10 10 5 10 10 10 10 10 5 10 10 5 10 10 10 10 10 5 10 10 10 10 6 10 9 10 10 5 9 10 6 10 8 7 4 3 7 3 8 5 10 10 10 6 4 10 10 10 10 10 10 5 10 10 10 10 10 7 8 10 10 10 10 10 5 10 1...
output:
7240 20 3640 5 21910 20 73600 50 5 4 3 2 1
result:
ok good plan
Test #39:
score: 24
Accepted
time: 1ms
memory: 5932kb
input:
4 1744 8 5 5 10 6 8 10 6 2 1 10 7 4 5 7 5 1 10 4 4 1 10 5 10 3 10 3 2 5 8 3 4 8 4 5 3 10 2 10 10 5 5 6 3 10 10 3 2 8 8 4 10 6 8 10 8 10 3 5 4 8 8 8 10 5 10 2 9 9 4 7 4 10 5 6 7 10 7 6 2 10 9 4 4 8 8 10 6 10 5 7 9 2 10 2 3 10 9 7 10 2 5 6 5 10 4 3 2 10 1 3 9 10 2 8 5 9 7 4 6 3 8 6 8 4 9 10 2 10 5 10 ...
output:
3427 8 6834 8 51985 40 4 3 2 1
result:
ok good plan
Test #40:
score: 24
Accepted
time: 0ms
memory: 5928kb
input:
2 1752 10 5 10 7 4 9 10 8 10 4 8 10 10 1 9 10 9 9 7 5 10 10 10 10 5 10 5 10 5 10 10 10 6 7 10 5 8 8 5 2 7 3 10 4 10 10 5 10 10 10 10 10 6 7 7 5 5 10 10 5 10 10 8 7 8 10 10 7 10 10 5 7 5 3 10 10 2 6 7 10 10 6 9 10 4 1 10 6 10 10 4 6 10 10 6 10 3 10 10 10 10 9 4 7 10 10 10 10 10 10 10 10 10 10 8 4 8 1...
output:
6972 8 2 1
result:
ok good plan
Test #41:
score: 24
Accepted
time: 0ms
memory: 5940kb
input:
5 1787 9 1 1 10 1 7 8 2 5 2 5 2 10 4 3 2 9 2 4 2 6 10 2 10 1 4 10 3 8 1 4 4 1 7 4 1 3 1 7 2 3 3 3 5 7 5 5 6 10 7 5 4 3 4 8 5 3 2 1 8 2 2 7 5 4 7 1 2 3 10 3 5 6 8 3 5 7 9 3 8 3 2 6 6 3 10 3 8 1 2 3 10 1 8 6 6 4 7 2 3 6 5 1 3 4 10 3 1 9 1 5 7 3 1 4 1 6 6 1 5 4 6 4 6 1 6 6 1 7 3 7 8 3 7 4 4 1 2 5 6 7 4...
output:
7024 20 14114 20 21156 20 35520 25 5 4 3 2 1
result:
ok good plan
Subtask #3:
score: 0
Wrong Answer
Test #42:
score: 71
Accepted
time: 18ms
memory: 31068kb
input:
563 467 8049 85539 27182 28071 94216 41847 50021 12220 27028 36160 7314 23133 44548 80654 65291 17329 61691 98590 68874 59735 6789 7383 17300 46373 35858 95819 15891 55598 25928 20662 99160 79046 1004 1901 33290 20640 86369 3246 36921 56090 11582 48092 48473 32198 80924 42208 80056 24593 43827 68820...
output:
22348400 56010618 44837792 56053406 68854267 55673944 93215158 53267119 99917765 44916703 132106351 47920308 183546783 56230188 218158172 54890811 185721461 40219031 235965024 44658849 275185257 47523393 260200404 39855333 160597838 22559973 370281996 48089208 449162366 53959609 387220215 42937195 4...
result:
ok good plan
Test #43:
score: 0
Wrong Answer
time: 112ms
memory: 70188kb
input:
1366 1257 52518 80009 48412 20437 83305 26867 69337 71593 7693 67667 97971 70439 22730 28465 48153 21841 82043 29245 52621 14973 60960 33492 98814 50223 73773 41144 3604 73526 5517 6397 76361 21299 35385 31974 51659 51949 13259 2630 82701 11777 34685 80651 10052 8110 36082 39167 88620 98236 3962 503...
output:
61247078 136526236 122140594 136130096 190049789 135653362 247538398 131645518 292191858 123692666 389791788 134620666 435296429 126945112 356913310 83851910 649915178 135918366 720258406 135645166 745467682 125702052 720660012 104012704 882701887 116471990 1118054788 133032008 1213651591 136281722 ...
result:
wrong answer