QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#719394#4740. Plan metranathan469033 16ms54548kbC++173.0kb2024-11-07 00:36:002024-11-07 00:36:00

Judging History

你现在查看的是最新测评结果

  • [2024-11-07 00:36:00]
  • 评测
  • 测评结果:33
  • 用时:16ms
  • 内存:54548kb
  • [2024-11-07 00:36:00]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define el cout << '\n'
#define f1(i,n) for(int i=1;i<=n;i++)
#define __file_name ""
using namespace std;
const ll maxn = 1e6+5, inf=1e18;

struct Edge{
    int u, v, w;
    Edge(){};
    Edge(int u, int v, int w): u(u), v(v), w(w){};
};

int n,d[maxn], l[maxn];
vector<int> mp[2*maxn], allv;
vector<Edge> ans;

bool cmp(int x, int y){
    return d[x] < d[y];
}

bool solve(int duv){
    for(int item: allv){
        mp[item + maxn].clear();
    }
    allv.clear();
    ans.clear();
    for(int i=2;i<n;i++){
        int diff = d[i] - l[i];
        if(mp[diff + maxn].empty()) allv.push_back(diff);
        mp[diff + maxn].push_back(i);
    }
//    int duv = 1e9;
//    for(int i=2;i<n;i++) duv = min(duv, d[i] + l[i]);
//    if(abs(*allv.begin()) == abs(*allv.rbegin()) && allv.size() <= 2) duv = abs(*allv.begin());
    if(mp[duv+maxn].empty()) allv.push_back(duv);
    if(mp[-duv+maxn].empty()) allv.push_back(-duv);
    mp[-duv+maxn].push_back(1); l[1] = duv;
    mp[duv+maxn].push_back(n); d[n] = duv;
    int rem2 = allv[0] & 1;
    for(int item: allv) {
        if((item & 1) != rem2) return false;
        sort(mp[item + maxn].begin(), mp[item + maxn].end(), cmp);
    }
    sort(allv.begin(), allv.end());
    int pre = 1, dst = 0;
    for(int item: allv){
        int u = mp[item + maxn][0];
//        cout << item << ' ' << u << ' ' << d[u] << ' ' << dst << endl;
//        for(Edge e: ans){
//            cout << e.u << ' ' << e.v << ' ' << e.w << '\n';
//        }
        if(u > 1){
            if(dst >= d[u]) return false;
            ans.push_back(Edge(pre, u, d[u] - dst));
            dst = d[u];
            if(duv - dst != l[u]) return false;
            pre = u;
        }
        if(dst > duv) return false;
        // int dst2 = dst;
        for(int i=1;i<mp[item+maxn].size();i++){
            int v = mp[item+maxn][i];
            if(d[v] <= dst) return false;
            ans.push_back(Edge(u, v, d[v] - dst));
            if(duv - dst + (d[v] - dst) != l[v]) return false;
        }
    }
    cout << "TAK\n";
    for(Edge e: ans){
        cout << e.u << ' ' << e.v << ' ' << e.w << '\n';
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    if(fopen(__file_name ".inp", "r")){
        freopen(__file_name ".inp","r",stdin);
        freopen(__file_name ".out","w",stdout);
    }
    // code here
    cin >> n;
    if(n == 2){
        cout << "TAK\n1 2 1\n";
        return 0;
    }
    for(int i=2;i<n;i++) cin >> d[i];
    for(int i=2;i<n;i++) cin >> l[i];
    for(int i=2;i<n;i++){
        int diff = d[i] - l[i];
        if(mp[diff + maxn].empty()) allv.push_back(diff);
        mp[diff + maxn].push_back(i);
    }
    sort(allv.begin(), allv.end());
    int duv = 1e9, duv2 = 1;
    for(int i=2;i<n;i++) duv = min(duv, d[i] + l[i]);
    duv2 = abs(*allv.begin());
    if(solve(duv)) return 0;
    if(solve(duv2)) return 0;
    cout << "NIE\n";
    return 0;
}

詳細信息

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 7ms
memory: 53856kb

input:

7
6 6 2 2 1
5 3 5 1 4

output:

TAK
1 6 1
1 4 2
1 5 2
5 2 4
5 7 1
7 3 3

result:

ok good solution

Test #2:

score: 11
Accepted
time: 7ms
memory: 53320kb

input:

10
31 89 20 19 19 20 19 164
70 88 20 20 20 19 20 125

output:

NIE

result:

ok no solution

Test #3:

score: 11
Accepted
time: 3ms
memory: 53816kb

input:

10
57 106 79 12 139 103 103 85
110 53 28 65 98 86 50 117

output:

NIE

result:

ok no solution

Test #4:

score: 11
Accepted
time: 0ms
memory: 53864kb

input:

10
13 62 24 125 13 15 54 94
1 76 14 113 1 1 68 82

output:

NIE

result:

ok no solution

Test #5:

score: 11
Accepted
time: 4ms
memory: 54252kb

input:

10
123 146 139 5 192 80 77 118
97 172 165 31 166 106 51 92

output:

TAK
1 5 5
1 7 80
1 4 139
1 3 146
1 10 26
10 8 51
10 9 92
10 2 97
10 6 166

result:

ok good solution

Test #6:

score: 11
Accepted
time: 7ms
memory: 53124kb

input:

10
112 67 152 16 6 28 1 8
111 82 137 31 21 41 14 7

output:

TAK
1 6 6
1 5 16
1 3 67
1 8 1
8 7 27
8 9 7
9 2 104
9 10 7
10 4 137

result:

ok good solution

Test #7:

score: 11
Accepted
time: 10ms
memory: 52976kb

input:

10
83 108 180 120 114 50 79 132
15 176 112 188 182 118 11 64

output:

TAK
1 7 50
1 3 108
1 6 114
1 5 120
1 10 68
10 8 11
10 2 15
10 9 64
10 4 112

result:

ok good solution

Test #8:

score: 11
Accepted
time: 9ms
memory: 52632kb

input:

10
65 149 150 119 51 90 64 172
66 150 151 120 52 91 65 173

output:

TAK
1 6 51
6 8 13
6 2 14
6 7 39
6 5 68
6 3 98
6 4 99
6 9 121
6 10 52

result:

ok good solution

Test #9:

score: 11
Accepted
time: 3ms
memory: 51936kb

input:

2



output:

TAK
1 2 1

result:

ok good solution

Test #10:

score: 11
Accepted
time: 0ms
memory: 54264kb

input:

10
46 145 46 19 165 20 145 99
47 146 47 112 76 112 146 6

output:

NIE

result:

ok no solution

Test #11:

score: 11
Accepted
time: 10ms
memory: 52620kb

input:

10
4 3 4 150 114 86 99 86
2 3 2 155 118 80 105 80

output:

NIE

result:

ok no solution

Test #12:

score: 11
Accepted
time: 11ms
memory: 54276kb

input:

10
6 7 12 168 171 12 7 7
6 5 14 180 159 14 6 5

output:

NIE

result:

ok no solution

Test #13:

score: 11
Accepted
time: 3ms
memory: 53772kb

input:

10
13 170 28 134 10 117 117 90
98 85 113 49 95 32 32 5

output:

TAK
1 6 10
1 2 13
1 4 28
1 10 85
10 9 5
10 7 32
10 8 32
10 5 49
10 3 85

result:

ok good solution

Test #14:

score: 11
Accepted
time: 0ms
memory: 54260kb

input:

10
90 2 53 53 158 58 1 114
89 1 54 54 161 59 2 111

output:

TAK
1 6 158
1 8 1
8 4 52
8 5 52
8 7 57
8 3 1
3 2 88
3 10 1
10 9 111

result:

ok good solution

Test #15:

score: 11
Accepted
time: 4ms
memory: 53244kb

input:

10
47 2 198 181 29 192 192 2
187 142 58 41 169 52 52 142

output:

TAK
1 3 2
1 9 2
1 6 29
1 2 47
1 10 140
10 5 41
10 7 52
10 8 52
10 4 58

result:

ok good solution

Test #16:

score: 11
Accepted
time: 3ms
memory: 53888kb

input:

10
78 128 140 162 140 110 191 70
79 129 141 163 141 111 192 71

output:

TAK
1 9 70
9 2 8
9 7 40
9 3 58
9 4 70
9 6 70
9 5 92
9 8 121
9 10 71

result:

ok good solution

Test #17:

score: 11
Accepted
time: 0ms
memory: 52820kb

input:

3
1
2

output:

TAK
1 2 1
2 3 2

result:

ok good solution

Subtask #2:

score: 22
Accepted

Dependency #1:

100%
Accepted

Test #18:

score: 22
Accepted
time: 4ms
memory: 52876kb

input:

1000
998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925...

output:

TAK
1 999 1
999 998 1
998 997 1
997 996 1
996 995 1
995 994 1
994 993 1
993 992 1
992 991 1
991 990 1
990 989 1
989 988 1
988 987 1
987 986 1
986 985 1
985 984 1
984 983 1
983 982 1
982 981 1
981 980 1
980 979 1
979 978 1
978 977 1
977 976 1
976 975 1
975 974 1
974 973 1
973 972 1
972 971 1
971 970 ...

result:

ok good solution

Test #19:

score: 22
Accepted
time: 4ms
memory: 53672kb

input:

1000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

TAK
1 2 1
2 3 1
2 4 2
2 5 3
2 6 4
2 7 5
2 8 6
2 9 7
2 10 8
2 11 9
2 12 10
2 13 11
2 14 12
2 15 13
2 16 14
2 17 15
2 18 16
2 19 17
2 20 18
2 21 19
2 22 20
2 23 21
2 24 22
2 25 23
2 26 24
2 27 25
2 28 26
2 29 27
2 30 28
2 31 29
2 32 30
2 33 31
2 34 32
2 35 33
2 36 34
2 37 35
2 38 36
2 39 37
2 40 38
2 ...

result:

ok good solution

Test #20:

score: 22
Accepted
time: 7ms
memory: 53736kb

input:

3000
3246 3738 4685 1539 2140 2026 4814 4815 2059 2686 4692 4403 2701 1596 4878 2470 3194 2272 2171 4120 2654 3349 1842 2046 4360 4529 4792 3250 1741 4766 4337 1559 1601 2362 2295 4463 4987 4119 3847 2272 1522 2882 4556 2484 2864 3002 1446 1772 3089 3092 2562 1461 3630 1879 1899 4881 2334 3189 1794 ...

output:

NIE

result:

ok no solution

Test #21:

score: 22
Accepted
time: 5ms
memory: 52884kb

input:

3000
4130 2457 3399 3125 2758 4911 615 1200 3017 4249 4344 2200 4005 876 4946 976 3067 2029 2158 2667 4183 1380 40 919 3377 2618 3007 1818 1033 227 4422 2971 3208 893 3079 1691 663 4139 2833 1218 4741 2450 789 4493 971 3215 4274 3039 2060 3742 2302 1506 4156 607 773 3151 2661 3913 4082 2956 4454 192...

output:

NIE

result:

ok no solution

Test #22:

score: 22
Accepted
time: 3ms
memory: 52800kb

input:

3000
954 3442 341 795 3138 3391 4895 1174 3801 2933 3695 3388 1743 2942 1572 1029 2173 1438 2270 724 4007 896 2465 4667 3054 249 246 4977 3675 2669 3911 339 2771 984 3399 1237 349 3190 1834 3114 4549 3675 4487 1586 881 2723 677 1290 2979 2710 4746 2994 2524 682 3646 2776 317 4457 2636 2524 3278 465 ...

output:

NIE

result:

ok no solution

Test #23:

score: 22
Accepted
time: 4ms
memory: 52792kb

input:

3000
1236 2492 766 600 2029 4796 1025 4509 3655 4410 1132 3591 2190 3687 3393 1965 4342 3081 4140 2178 476 425 3368 2239 3481 245 548 4122 2637 4282 2385 606 2502 1565 1925 1754 2384 4313 3465 1490 2259 4430 1678 1632 1938 2513 3731 1713 3283 3289 3403 1979 1846 668 2635 3797 4226 4092 614 2677 1977...

output:

TAK
1 1265 2
1 200 3
1 1737 4
1 2550 5
1 834 6
1 299 7
1 1328 8
1 1856 10
1 1747 15
1 2087 16
1 2862 17
1 1309 18
1 2362 19
1 1624 26
1 2307 27
1 1324 29
1 1190 30
1 2645 32
1 626 36
1 2007 39
1 994 42
1 612 46
1 580 48
1 1401 49
1 2418 50
1 2864 51
1 2723 52
1 2573 59
1 2966 60
1 526 64
1 2988 65
1...

result:

ok good solution

Test #24:

score: 22
Accepted
time: 4ms
memory: 53852kb

input:

3000
2567 1720 478 391 3422 4790 4949 2339 4239 919 1382 3856 4907 3545 4073 2037 3854 4075 2618 1578 2198 1964 2263 3825 2860 3242 2777 3795 2069 1280 1188 645 2323 4900 4781 4018 4425 4246 4049 2145 2096 1017 3644 3069 3423 3773 3587 4999 4324 1368 677 803 2346 4166 2428 4842 3374 2423 4618 2514 3...

output:

TAK
1 2559 5
1 2742 37
1 2133 97
1 1717 260
1 143 263
1 939 363
1 2756 381
1 2417 390
1 873 414
1 1728 532
1 1993 622
1 1801 669
1 1279 689
1 1905 751
1 457 766
1 53 803
1 168 837
1 2190 842
1 1235 881
1 1844 887
1 2476 972
1 1746 975
1 1433 999
1 819 1008
1 2615 1023
1 1794 1058
1 2317 1132
1 571 1...

result:

ok good solution

Test #25:

score: 22
Accepted
time: 5ms
memory: 53412kb

input:

3000
4989 4334 179 1994 2064 2545 1064 4694 1823 4758 688 3273 875 708 2573 451 2326 4205 4815 1534 3459 2928 3565 3638 1987 4345 1414 4035 2531 1228 1589 3596 4318 3415 4512 2953 2003 2151 1650 4365 1935 4182 1154 1660 1760 1644 2423 1301 3310 2072 3024 1718 4061 1106 2165 4436 2082 1667 3732 260 3...

output:

TAK
1 304 1
304 959 1
304 2292 6
304 2603 14
304 1611 15
304 936 16
304 2710 18
304 2092 19
304 650 20
304 2459 23
304 1790 25
304 1446 26
304 1154 34
304 1407 42
304 1854 50
304 2769 52
304 2471 53
304 2959 73
304 2432 79
304 2500 83
304 2287 86
304 838 87
304 699 89
304 740 95
304 1467 96
304 906 ...

result:

ok good solution

Test #26:

score: 22
Accepted
time: 7ms
memory: 53588kb

input:

3000
1352 2311 3356 3752 3704 2206 3802 2718 1693 3838 2439 1539 2157 2532 3342 2895 2380 1628 3603 3822 1283 4277 3128 4180 2361 3794 3853 4837 3991 4926 2307 4054 3399 3864 1265 2472 4890 1604 1800 4204 4133 4192 4630 3934 4785 3913 1573 4835 2828 3636 2702 2551 4335 2662 4159 2147 3808 3148 3371 ...

output:

TAK
1 2681 1260
2681 1296 9
2681 264 10
2681 1165 13
2681 686 37
2681 1349 46
2681 1744 57
2681 552 60
2681 2011 70
2681 1618 89
2681 2783 103
2681 748 107
2681 101 135
2681 254 167
2681 1917 168
2681 2616 194
2681 1872 204
2681 2116 215
2681 2818 218
2681 564 220
2681 1376 224
2681 2781 229
2681 22...

result:

ok good solution

Test #27:

score: 22
Accepted
time: 5ms
memory: 54548kb

input:

3000
3097 3903 4418 1796 1042 4657 1430 2005 2767 3209 4552 1943 4809 4841 1355 4449 1330 1489 4339 886 749 4199 4558 4731 4947 601 3155 2695 3142 962 3101 2429 737 1891 3333 4856 3247 2016 2097 2504 4465 4420 2036 3511 1433 3773 1896 4490 2307 1489 2123 4623 2931 840 2268 3805 1984 2726 1790 1120 4...

output:

NIE

result:

ok no solution

Test #28:

score: 22
Accepted
time: 12ms
memory: 53384kb

input:

3000
886 2441 1532 1519 993 2071 1533 706 3290 3577 2399 3107 1818 2494 4684 3579 1157 3779 2708 1157 2737 1792 967 3015 2289 2691 4486 2122 2800 2027 3277 4540 3785 1152 4885 2099 1008 2799 3230 1610 3568 4055 2860 1931 1482 4322 3415 3720 3930 3986 2518 1314 1596 1392 469 3657 1438 4159 2898 2654 ...

output:

NIE

result:

ok no solution

Test #29:

score: 22
Accepted
time: 3ms
memory: 53232kb

input:

3000
2696 919 556 3002 1270 4174 2500 353 1352 3944 635 3440 4641 1575 4667 3561 3900 3147 1359 3273 938 829 900 2902 83 1087 302 1109 1910 4061 966 2803 4023 3639 2809 1303 1344 3385 2796 1538 1498 4548 1707 1888 3827 69 2512 557 610 3502 3360 1799 4427 669 3527 2313 4578 4303 2867 1200 1568 488 28...

output:

NIE

result:

ok no solution

Test #30:

score: 22
Accepted
time: 7ms
memory: 53216kb

input:

3000
2853 4599 4265 4267 2411 1064 1784 2058 1150 2720 2494 4060 1681 2671 3694 2359 2568 717 3405 1 1969 791 2362 2547 386 1547 2175 650 3372 4654 2080 2451 2143 397 3823 339 1073 3915 1218 905 3584 1340 901 681 240 2919 2433 4199 4842 2488 3026 724 3660 1325 265 4696 2023 4322 4057 2231 2640 4469 ...

output:

TAK
1 21 1
21 856 3
21 620 4
21 2601 7
21 156 8
21 2125 9
21 525 10
21 1563 12
21 1344 16
21 995 23
21 2163 25
21 1804 27
21 2887 29
21 1865 30
21 739 32
21 101 35
21 1423 36
21 2377 37
21 199 38
21 1736 41
21 2129 42
21 2584 45
21 1652 48
21 2204 49
21 1691 50
21 532 54
21 2484 55
21 2303 56
21 268...

result:

ok good solution

Test #31:

score: 22
Accepted
time: 3ms
memory: 54380kb

input:

3000
2218 4876 1974 1767 390 3598 1346 2423 981 4265 1477 3160 1900 2063 4806 624 2391 4129 1166 3586 3094 1018 1384 2665 3668 2680 3722 3123 4195 3774 3897 1755 4422 1528 3473 3656 2016 992 4424 582 1797 1852 4493 3604 2722 1591 2900 2124 1375 4122 284 3011 4290 3482 4840 1712 2916 684 1624 1356 47...

output:

TAK
1 2526 7
1 1021 15
1 1700 34
1 2891 54
1 727 57
1 368 62
1 597 71
1 2974 95
1 2114 125
1 456 133
1 1114 134
1 2256 154
1 478 177
1 1719 200
1 2779 207
1 2634 238
1 2555 264
1 535 279
1 1546 287
1 1005 292
1 1237 308
1 284 363
1 2485 416
1 2839 465
1 2785 501
1 67 522
1 1142 531
1 254 559
1 2733 ...

result:

ok good solution

Test #32:

score: 22
Accepted
time: 11ms
memory: 54292kb

input:

3000
1091 3360 3940 2706 3309 1955 1031 4529 3713 3820 3280 1916 952 4104 262 4281 3753 3446 1426 3135 3016 50 4491 3646 1717 3391 3677 2804 3046 3658 342 4348 4900 3701 1141 4942 907 4024 1412 1922 2071 4306 3746 1073 2301 517 2824 3500 1580 105 2728 3224 4806 3607 4640 3007 4097 3525 2260 28 74 13...

output:

TAK
1 483 1
483 1362 1
483 1936 3
483 2086 5
483 2594 7
483 1611 8
483 1983 11
483 476 13
483 2042 15
483 2548 18
483 1082 20
483 2241 21
483 2308 22
483 408 23
483 2407 25
483 2157 26
483 61 27
483 2692 29
483 2177 30
483 2679 34
483 1737 36
483 2717 37
483 236 41
483 397 42
483 222 44
483 525 45
4...

result:

ok good solution

Test #33:

score: 22
Accepted
time: 11ms
memory: 53192kb

input:

3000
3066 4794 1434 2322 1630 2913 1767 2035 4692 1441 3958 1787 2971 4301 3880 2889 3648 3292 3412 3012 2637 3888 4310 4986 4854 1983 2463 3127 4270 4277 3117 4782 4979 4226 3572 2153 4973 4226 2459 2092 4055 4711 1362 4527 1967 4794 1576 4563 3917 3941 2122 2808 1769 2958 4199 1431 4698 4117 4978 ...

output:

TAK
1 1445 1270
1445 1558 35
1445 2254 40
1445 2218 289
1445 1023 379
1445 2087 898
1445 1748 1613
1445 1679 1849
1445 2182 1926
1445 823 2505
1445 2993 2683
1445 848 2937
1445 1104 3083
1445 757 3387
1445 1041 3675
1445 2733 1
2733 1472 86
2733 2884 118
2733 2703 260
2733 2347 289
2733 2089 295
273...

result:

ok good solution

Test #34:

score: 22
Accepted
time: 7ms
memory: 54352kb

input:

3000
3007 4339 2713 1682 3269 896 4912 1719 4017 2821 4716 4834 3914 2774 4564 1041 3359 1294 2362 3216 811 4452 4433 4144 1481 1748 3833 1420 1847 1424 1051 2678 2486 2506 2275 2397 3745 612 2430 3651 2980 3630 2386 3229 4982 3356 4081 4489 2604 4456 3572 1906 2670 3437 4940 2119 4182 4332 2324 368...

output:

NIE

result:

ok no solution

Test #35:

score: 22
Accepted
time: 15ms
memory: 53460kb

input:

3000
2113 2877 3332 1103 4221 1402 4988 3090 4447 3216 1214 2798 955 3564 3217 1640 3071 535 3509 1280 2014 2438 4628 1313 4929 3109 2404 4673 3314 1876 2131 4980 1943 2809 3748 3561 3790 1597 1120 2025 2927 2952 3810 1676 2214 3217 2319 1247 4407 2023 3757 1276 983 3849 2859 4187 2397 1631 1041 341...

output:

NIE

result:

ok no solution

Test #36:

score: 22
Accepted
time: 5ms
memory: 53784kb

input:

3000
1941 4646 2168 786 3079 4598 455 2861 4243 3087 3829 1626 2823 2402 4194 1680 3570 2198 1509 269 4882 99 3402 90 847 4219 3347 1955 757 88 134 2186 363 683 4604 1303 4488 2916 4352 551 2002 2107 4420 4418 4068 4754 3143 449 2727 2952 2414 3510 2293 2404 1223 1883 2098 2705 2223 3573 1742 4892 8...

output:

NIE

result:

ok no solution

Test #37:

score: 22
Accepted
time: 7ms
memory: 53564kb

input:

3000
4823 3370 3546 689 4392 2253 1309 1492 3406 3625 1540 1996 4594 1050 1342 2511 1137 1314 3871 693 1583 4453 2136 4567 2421 3968 956 4538 2083 534 537 1435 4836 3214 4443 607 3882 2646 171 1212 3325 4061 4967 4678 1267 3035 542 748 1552 8 851 2456 1224 210 2791 3160 257 4498 2664 2658 1450 3532 ...

output:

TAK
1 941 1
1 126 5
1 51 8
1 392 13
1 119 14
1 275 16
1 1254 29
1 2461 30
1 2162 34
1 1363 35
1 2440 36
1 2262 37
1 2763 43
1 450 44
1 2259 47
1 2210 49
1 878 52
1 67 59
1 2087 60
1 1165 63
1 1737 65
1 241 67
1 2229 68
1 732 73
1 495 77
1 640 80
1 2242 82
1 78 83
1 846 85
1 1671 86
1 1436 88
1 1433 ...

result:

ok good solution

Test #38:

score: 22
Accepted
time: 3ms
memory: 53168kb

input:

3000
3332 756 2055 1288 1561 1514 2953 536 3784 2353 423 4776 2334 2892 2112 1377 4588 1432 999 3987 3063 1186 945 696 1028 1459 3404 147 4055 467 721 3838 2162 793 3748 3218 1458 2074 3532 2710 768 452 2784 1080 4603 953 1112 4307 2720 1891 2228 726 2429 1093 1606 2130 4564 1780 2546 1829 1373 1104...

output:

TAK
1 1111 7
1 1724 17
1 2729 18
1 1741 26
1 1520 29
1 1259 36
1 565 48
1 2556 81
1 269 87
1 2125 103
1 1729 131
1 2985 141
1 1629 143
1 29 147
1 1117 152
1 2761 157
1 2284 159
1 2285 172
1 827 173
1 87 177
1 2553 182
1 517 184
1 1809 197
1 703 202
1 883 207
1 2260 210
1 914 216
1 2689 237
1 2304 23...

result:

ok good solution

Test #39:

score: 22
Accepted
time: 16ms
memory: 54072kb

input:

3000
610 1799 1393 878 3099 1418 555 4169 1562 4823 4392 1525 2214 4168 975 4890 2034 1330 1266 946 2075 307 1229 2186 2106 473 3813 1702 309 1364 1328 956 906 2762 2254 4157 1434 2144 4442 3727 645 231 1985 4331 1625 544 602 1530 820 2125 909 1635 331 2216 1040 2794 1910 1764 4207 37 4032 4231 3354...

output:

TAK
1 2586 1
1 531 2
1 2498 3
1 2738 4
1 2315 6
1 2136 7
1 2777 8
1 922 9
1 2984 10
1 2424 11
1 2282 12
1 1103 13
1 430 14
1 2760 15
1 890 16
1 623 17
1 2702 18
1 2068 19
1 2431 20
1 852 21
1 127 22
1 258 23
1 345 24
1 1482 25
1 2639 26
1 1875 29
1 1904 30
1 2875 31
1 1107 32
1 770 33
1 2493 34
1 71...

result:

ok good solution

Test #40:

score: 22
Accepted
time: 12ms
memory: 53872kb

input:

3000
4392 2140 1762 1461 3944 3373 4608 2697 4508 3925 2016 1302 1448 1844 3854 4939 4992 2464 2034 3218 2114 1842 4347 3542 2030 4337 4016 3264 3751 1853 4686 1828 4083 4348 2692 4589 4107 3632 3108 2720 3526 3300 2029 3304 4522 1722 3600 4343 2664 3156 4156 1738 2972 3083 2460 2676 4999 1868 4196 ...

output:

TAK
1 1220 1270
1220 1089 3
1220 1168 7
1220 1443 11
1220 2153 12
1220 1480 43
1220 184 74
1220 1033 75
1220 111 92
1220 2415 133
1220 440 170
1220 1410 181
1220 2579 199
1220 936 208
1220 91 216
1220 541 220
1220 1183 222
1220 1956 235
1220 1907 248
1220 1555 267
1220 703 277
1220 2434 289
1220 281...

result:

ok good solution

Test #41:

score: 22
Accepted
time: 6ms
memory: 54124kb

input:

3000
3776 3020 74 3836 4635 2332 3602 1143 1563 561 2317 1552 3531 1627 1560 3621 4104 4827 4065 1455 1113 4256 3436 107 3547 4420 1826 3772 4563 3927 4787 2141 3872 2726 607 2231 741 1769 4393 1596 2722 3962 3138 2631 4816 2958 4416 1539 1622 4220 1251 4873 4258 1589 3411 3298 2222 3702 1461 899 62...

output:

NIE

result:

ok no solution

Test #42:

score: 22
Accepted
time: 4ms
memory: 54296kb

input:

3000
3417 1286 2330 2910 1263 1904 2737 441 2043 2538 2191 3631 735 4281 1323 23 2407 2205 2405 2006 1822 2649 2622 526 1686 404 2569 3775 1194 3323 3357 2468 2466 374 1775 2699 1300 4548 2725 2306 4895 3011 4969 3321 1057 1716 3863 3360 3212 1994 4246 1212 644 3247 1964 962 2590 2942 818 2489 4223 ...

output:

NIE

result:

ok no solution

Test #43:

score: 22
Accepted
time: 4ms
memory: 54456kb

input:

3000
2126 1360 2131 843 4339 3597 4621 4533 4809 1878 4303 4777 2153 263 4424 1155 3541 1201 902 718 1277 2918 3751 2585 706 507 3311 4920 1164 1080 3461 4868 970 1274 625 3964 511 2880 2594 4673 3685 4602 510 1459 4702 1565 94 3545 255 3943 591 327 18 4823 1373 4165 1833 4489 1202 717 2532 4699 142...

output:

NIE

result:

ok no solution

Test #44:

score: 22
Accepted
time: 3ms
memory: 53072kb

input:

3000
1149 3550 1728 2850 1560 200 3630 4848 2568 1394 3044 2947 2576 589 2523 4333 3635 1043 3508 580 2380 2902 4838 4531 1484 4328 654 4418 2761 506 1862 498 2891 4653 2062 4698 4399 1389 1167 62 2304 329 1904 1142 2031 3770 3005 4208 668 453 468 2324 1741 823 3262 4403 1424 2565 4335 2592 3324 802...

output:

TAK
1 1019 9
1 1948 18
1 2208 25
1 969 25
1 1771 25
1 779 30
1 1260 41
1 2137 41
1 272 48
1 2830 54
1 2648 54
1 452 54
1 340 58
1 2357 58
1 1197 63
1 2620 68
1 891 68
1 322 68
1 77 86
1 2867 99
1 2025 106
1 796 106
1 1704 108
1 1527 115
1 1404 119
1 465 119
1 2828 119
1 2116 119
1 1617 119
1 2287 12...

result:

ok good solution

Test #45:

score: 22
Accepted
time: 5ms
memory: 52816kb

input:

3000
1635 282 203 1698 4542 4581 66 4702 4313 1436 2957 1820 4475 3991 1646 864 1367 4202 2545 1317 2712 1529 1371 370 1656 1932 654 3311 372 3257 844 4365 2111 2359 1379 405 3050 2395 29 3467 3429 3417 554 2911 2615 3735 2696 4529 2573 4394 3925 3605 3212 2655 469 1981 465 1141 1791 2303 4758 333 1...

output:

TAK
1 2708 60
1 474 64
1 2985 107
1 163 142
1 2391 155
1 1697 170
1 4 203
1 1558 214
1 1704 215
1 2779 216
1 2421 221
1 293 322
1 30 372
1 1884 374
1 2457 375
1 469 381
1 1346 403
1 1706 415
1 2107 435
1 328 445
1 724 463
1 407 465
1 635 473
1 1455 526
1 2901 565
1 920 579
1 532 601
1 2679 616
1 130...

result:

ok good solution

Test #46:

score: 22
Accepted
time: 3ms
memory: 52932kb

input:

3000
3095 3686 2303 4864 4525 4973 686 2608 2702 3043 1530 398 971 2975 249 3931 1914 2949 2100 1211 636 270 735 172 799 1903 4870 2863 504 1980 1613 2760 2753 96 3261 2262 2965 1590 3374 2417 618 1414 3734 2313 4838 855 3014 403 4064 405 2692 4503 4068 3962 255 2631 4061 2216 1937 2683 1290 590 545...

output:

TAK
1 2279 5
1 1048 8
1 2556 8
1 2846 9
1 513 11
1 1671 13
1 1138 15
1 348 17
1 874 18
1 916 19
1 1002 20
1 2233 21
1 599 22
1 1499 26
1 86 27
1 2908 31
1 574 35
1 1891 36
1 2903 37
1 2941 39
1 2770 40
1 1164 43
1 2724 44
1 1535 46
1 2217 46
1 1972 48
1 933 51
1 176 56
1 652 57
1 2736 59
1 957 63
1 ...

result:

ok good solution

Test #47:

score: 22
Accepted
time: 3ms
memory: 53496kb

input:

3000
3150 1836 3172 4068 4876 2943 3457 2989 2031 4298 3147 2187 3949 1874 3444 3509 3477 3857 4473 4688 4270 3254 2633 2539 2586 2095 4295 2717 2061 3175 2604 3459 3514 2929 4280 2896 4154 4187 4400 1897 4733 1450 2311 2971 4025 2366 3119 1779 1624 3743 2393 2767 4341 3316 1467 2982 3749 3553 3430 ...

output:

TAK
1 2891 1321
2891 1164 1
2891 1758 9
2891 2627 15
2891 1264 22
2891 306 32
2891 637 54
2891 443 69
2891 2646 76
2891 2970 103
2891 2846 116
2891 191 126
2891 865 127
2891 2097 137
2891 56 146
2891 2874 148
2891 2661 156
2891 1036 169
2891 238 176
2891 1196 181
2891 578 182
2891 616 196
2891 1110 ...

result:

ok good solution

Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #48:

score: 16
Accepted
time: 7ms
memory: 53892kb

input:

3000
33632 494127 696342 350424 494687 244029 34205 358600 33589 33688 33654 363547 917716 709668 34132 209516 647123 33932 459553 338587 344502 34173 33962 959639 186658 432587 751908 196121 831694 938534 375210 34215 33945 496720 944120 717068 359228 823700 795101 264198 894106 166421 878905 56096...

output:

NIE

result:

ok no solution

Test #49:

score: 16
Accepted
time: 8ms
memory: 52760kb

input:

3000
719501 190371 419469 530974 227226 585792 231123 604640 810638 945824 81162 234692 81417 470485 81514 904536 160555 81120 458883 833590 292427 298463 696428 991251 803836 290845 81271 164910 812817 311546 346303 182445 988478 81452 141870 399912 573781 113364 81366 707078 81447 579746 652421 74...

output:

NIE

result:

ok no solution

Test #50:

score: 16
Accepted
time: 3ms
memory: 54008kb

input:

3000
33367 117225 986863 489993 459134 848608 659883 682415 386653 418414 25671 596199 603604 686775 61167 861049 479739 998241 526134 349446 175511 428454 577920 180611 399767 519572 413504 675392 691762 456302 401104 641737 992570 216016 396301 671015 937784 490764 151444 958516 175964 611128 5533...

output:

NIE

result:

ok no solution

Test #51:

score: 16
Accepted
time: 4ms
memory: 53964kb

input:

3000
260266 727761 367878 933399 741131 526721 356038 469953 595663 297117 360534 710090 328255 86691 112505 523756 449413 409669 321665 538883 631287 870029 374437 621113 243200 488734 528312 245165 63888 469460 162819 286313 659751 375112 725042 852767 50740 335486 612512 698770 344877 461833 3401...

output:

TAK
1 244 1024
1 2572 1191
1 2206 2604
1 359 2631
1 1425 3247
1 474 4688
1 2829 5714
1 1696 6565
1 112 6574
1 2143 7441
1 809 8470
1 134 8918
1 922 9660
1 73 11198
1 767 11786
1 722 12647
1 1455 13110
1 1560 13232
1 2058 14743
1 2104 14777
1 1183 15617
1 1788 16407
1 2552 16780
1 181 17194
1 962 172...

result:

ok good solution

Test #52:

score: 16
Accepted
time: 5ms
memory: 54392kb

input:

3000
990602 644534 718130 852792 816707 576523 58111 482057 102335 439369 73379 670012 929674 479443 361759 70928 79563 613769 853718 167957 655511 263428 76069 534776 73859 214474 58816 163198 518911 871410 518783 482805 378241 481322 213457 58326 434589 506037 323789 931785 657187 697710 40451 325...

output:

TAK
1 2926 1700
1 1282 3606
1 654 4681
1 301 6593
1 2594 7075
1 512 8651
1 1609 10123
1 167 10301
1 2675 11012
1 1559 11712
1 1101 12425
1 949 13202
1 1300 14537
1 1102 15016
1 2912 16611
1 2403 17933
1 411 18358
1 2654 19329
1 2462 21592
1 1477 21882
1 2953 24681
1 2930 24835
1 2189 24907
1 2308 25...

result:

ok good solution

Test #53:

score: 16
Accepted
time: 10ms
memory: 54516kb

input:

3000
123371 312195 835995 149637 799487 170772 195292 648627 476326 803490 674499 244504 429531 806106 255448 371496 627676 780092 473422 303011 943356 44364 430413 893362 706897 367434 126526 297689 257900 841409 228421 592559 817799 53260 349853 208307 3859 708783 827617 707957 652158 62545 147155...

output:

TAK
1 997 322
1 2756 1211
1 1769 1823
1 490 2172
1 38 3859
1 1126 6023
1 1478 6280
1 686 6503
1 776 7225
1 1680 8118
1 2604 8214
1 976 8915
1 1827 8927
1 667 9597
1 200 9813
1 655 9878
1 2841 9968
1 228 10316
1 2610 10888
1 1387 10889
1 2386 11000
1 1211 11697
1 909 12507
1 1849 12821
1 1946 13015
1...

result:

ok good solution

Test #54:

score: 16
Accepted
time: 4ms
memory: 54020kb

input:

3000
704276 595819 568590 836740 981560 800902 584618 694682 933504 974612 414162 378635 951690 459865 651877 937255 771192 697635 745645 614206 558771 409173 874112 760798 801123 668957 436923 787718 511406 483169 378210 847039 812786 739322 999151 816301 783567 639619 903009 667105 988812 488588 4...

output:

TAK
1 1474 363709
1474 2028 1
2028 1820 437
2028 2000 2585
2028 2372 4314
2028 392 5990
2028 489 7659
2028 2652 10056
2028 1071 10500
2028 1985 12133
2028 2510 12932
2028 2718 13850
2028 1026 16602
2028 189 16826
2028 303 22732
2028 324 25922
2028 369 26573
2028 800 29383
2028 1193 29532
2028 2943 3...

result:

ok good solution

Test #55:

score: 0
Runtime Error

input:

3
1000000
1000000

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%