QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#271191#7119. Longest TripLeticiaFCS15 7ms4108kbC++202.7kb2023-12-02 04:56:312024-04-28 09:02:58

Judging History

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

  • [2024-04-28 09:02:58]
  • 管理员手动重测本题所有提交记录
  • 测评结果:15
  • 用时:7ms
  • 内存:4108kb
  • [2023-12-02 04:56:31]
  • 评测
  • 测评结果:15
  • 用时:7ms
  • 内存:4144kb
  • [2023-12-02 04:56:31]
  • 提交

answer

#include "longesttrip.h"
#include<bits/stdc++.h>
using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    if(D == 3){
        vector<int> ans(N);
        iota(ans.begin(), ans.end(), 0);
        return ans;
    }
    if(D == 2){
        deque<int> ans;
        int start = 3;
        if(are_connected({0}, {1}))
            ans = {0, 1}, start = 2; 
        else
            ans = {0, 2, 1};
        
        for(int v = start; v < N; v++){
            if(are_connected({ans.front()}, {v})) ans.push_front(v);
            else ans.push_back(v);
        }
        return {ans.begin(), ans.end()};
    }
    if(false && D == 1){
        vector<vector<int>> ans = {{0}, {1}};
        for(int v = 2; v < N; v++){
            int a = ans[0].back();
            int b = ans[1].back();
            if(are_connected({a}, {v})){
                ans[0].push_back(v);
            } else if(are_connected({b}, {v}))
                ans[1].push_back(v);
            else{
                ans[0].insert(ans[0].end(), ans[1].rbegin(), ans[1].rend());
                ans[1] = {v};
            }          
        }
        if(ans[0].size() > ans[1].size()) return ans[0];
        else return ans[1];
    }
    if(D == 1){
        vector<vector<int>> ans = {{0}};
        for(int v = 2; v < N; v++){
            if(ans.size() == 1){
                if(are_connected({ans[0].back()}, {v})) ans[0].push_back(v);
                else ans.push_back({v});
            } else {
                bool a = are_connected({ans[0].back()}, {v});
                bool b = are_connected({ans[1].back()}, {v});
                if(a && b){
                    ans[0].push_back(v);
                    ans[0].insert(ans[0].end(), ans[1].rbegin(), ans[1].rend());
                    ans.pop_back();
                } else if(!a && !b){
                    ans[0].insert(ans[0].end(), ans[1].rbegin(), ans[1].rend());
                    ans[1] = {v};
                } else if(a){
                    ans[0].push_back(v);
                } else{
                    ans[1].push_back(v);
                }
            }    
        }
        if(ans.size() == 1) return ans[0];
        // if(are_connected({ans[0][0]}, {ans[1][0]})){
        //     reverse(ans[0].begin(), ans[0].end());
        //     ans[0].insert(ans[0].end(), ans[1].begin(), ans[1].end());
        //     return ans[0];
        // }
        // if(are_connected({ans[0][0]}, {ans[1].back()})){
        //     ans[1].insert(ans[1].end(), ans[0].begin(), ans[0].end());
        //     return ans[1];
        // }

        if(ans[0].size() > ans[1].size()) return ans[0];
        else return ans[1];
    }
    return {};
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 4108kb

input:

341
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 ...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2...

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

103
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048...

result:

ok 

Test #3:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

22
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
12 3
1
12 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 50 0 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
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 50 0 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 3...

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

8
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 128 0 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 9...

result:

ok 

Test #5:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

4
256 3
1
256 3
1
256 3
1
256 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 256 0 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 9...

result:

ok 

Subtask #2:

score: 10
Accepted

Test #6:

score: 10
Accepted
time: 3ms
memory: 4100kb

input:

341
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 2 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 2 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1...

result:

ok 

Test #7:

score: 0
Accepted
time: 6ms
memory: 3840kb

input:

103
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #8:

score: 0
Accepted
time: 7ms
memory: 4108kb

input:

22
50 2
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
50 2
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
50 2
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #9:

score: 0
Accepted
time: 1ms
memory: 4068kb

input:

8
128 2
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
128 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #10:

score: 0
Accepted
time: 7ms
memory: 3812kb

input:

4
256 2
1
1
1
1
1
1
1
1
1
1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BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 3 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1...

result:

ok 

Test #12:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

103
10 2
0
1
0
1
1
0
1
1
1
10 2
1
1
0
1
1
0
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
0
1
1
1
10 2
1
1
1
1
1
1
0
1
1
1
10 2
0
1
1
1
0
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
0
1
1
1
1
0
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 8...

result:

ok 

Test #13:

score: 0
Accepted
time: 3ms
memory: 3816kb

input:

22
50 2
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
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
50 2
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
50 2
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #14:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

11
101 2
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
101 2
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...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #15:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

4
256 2
1
1
1
1
1
1
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2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #17:

score: 0
Accepted
time: 4ms
memory: 3800kb

input:

4
256 2
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
0
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Test #18:

score: 0
Accepted
time: 3ms
memory: 3804kb

input:

4
256 2
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #19:

score: 25
Accepted
time: 0ms
memory: 4096kb

input:

341
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
3 1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 2 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 2 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 2 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2I...

result:

ok 

Test #20:

score: 0
Accepted
time: 2ms
memory: 4076kb

input:

103
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 7 8...

result:

ok 

Test #21:

score: 0
Accepted
time: 5ms
memory: 3788kb

input:

22
50 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
50 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
50 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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 7 8...

result:

ok 

Test #22:

score: 0
Accepted
time: 2ms
memory: 4108kb

input:

8
128 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
128 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 7 8...

result:

ok 

Test #23:

score: 0
Accepted
time: 7ms
memory: 3800kb

input:

4
256 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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 7 8...

result:

ok 

Test #24:

score: -25
Wrong Answer
time: 1ms
memory: 3816kb

input:

341
3 1
1
1
3 1
0

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 2 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 1 2

result:

wrong answer 

Subtask #4:

score: 0
Wrong Answer

Test #83:

score: 0
Wrong Answer
time: 1ms
memory: 4092kb

input:

341
3 1
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 2 0 2

result:

wrong answer