QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#642916#9439. Aim Highucup-team4992AC ✓0ms3604kbC++202.8kb2024-10-15 17:01:522024-10-15 17:01:52

Judging History

This is the latest submission verdict.

  • [2024-10-15 17:01:52]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3604kb
  • [2024-10-15 17:01:52]
  • Submitted

answer

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

int n;
vector<array<int, 6>> ans;

void mov(int fx, int fy, int px, int py, int tx, int ty){
    ans.push_back({fx, fy, px, py, tx, ty});
    // cout << fx << ' ' << fy << ' ' << px << ' ' << py << ' ' << tx << ' ' << ty << "\n";
}

void print(){
    cout << ans.size() << "\n";
    for(auto x : ans){
        for(auto y : x){
            cout << y << ' ';
        }
        cout << "\n";
    }
}

int main(){
    int kase;
    cin >> kase;
    while(kase--){
        cin >> n;
        if(n > 4){
            cout << "-1\n";
            continue;
        }
        ans.clear();
        mov(0, -3, 1, -3, 1, -2);
        mov(3, -3, 2, -3, 2, -2);
        mov(4, -3, 5, -3, 5 ,-2);
        mov(7, -3, 6, -3, 6, -2);
        mov(8, -3, 9, -3, 9, -2);
        mov(11, -3, 10, -3, 10, -2);
        mov(12, -3, 13, -3, 13, -2);
        mov(15, -3, 14, -3, 14, -2);

        mov(0, -2, 1, -2, 1, -1);
        mov(1, -2, 2, -2, 2, -1);
        mov(2, -2, 3, -2, 3, -1);
        mov(5, -2, 4, -2, 4, -1);
        mov(6, -2, 5, -2, 5, -1);
        mov(7, -2, 6, -2, 6, -1);

        mov(8, -2, 9, -2, 9, -1);
        mov(9, -2, 10, -2, 10, -1);
        mov(10, -2, 11, -2, 11, -1);
        mov(13, -2, 12, -2, 12, -1);
        mov(14, -2, 13, -2, 13, -1);
        mov(15, -2, 14, -2, 14, -1);

        mov(0, -1, 1, -1, 1, 0);
        mov(1, -1, 2, -1, 2, 0);
        mov(2, -1, 3, -1, 3, 0);
        mov(3, -1, 4, -1, 4, 0);
        mov(4, -1, 5, -1, 5, 0);
        mov(5, -1, 6, -1, 6, 0);
        mov(6, -1, 7, -1, 7, 0);
        mov(9, -1, 8, -1, 8, 0);
        mov(10, -1, 9, -1, 9, 0);
        mov(11, -1, 10, -1, 10, 0);
        mov(12, -1, 11, -1, 11, 0);
        mov(13, -1, 12, -1, 12, 0);
        mov(14, -1, 13, -1, 13, 0);
        mov(15, -1, 14, -1, 14, 0);

        mov(1, 0, 2, 0, 2, 1);
        mov(3, 0, 4, 0, 4, 1);
        mov(2, 0, 2, 1, 3, 1);
        mov(3, 0, 3, 1, 4, 1);
        mov(4, 0, 4, 1, 5, 1);
        if(n <= 1){
            print();
            continue;
        }
        mov(4, 1, 5, 1, 5, 2);

        mov(12, 0, 11, 0, 11, 1);
        mov(10, 0, 9, 0, 9, 1);
        mov(11, 0, 11, 1, 10, 1);
        mov(10, 0, 10, 1, 9, 1);
        mov(9, 0, 9, 1, 8, 1);
        mov(9, 1, 8, 1, 8, 2);

        if(n <= 2){
            print();
            continue;
        }

        mov(5, 0, 6, 0, 6, 1);
        mov(5, 0, 6, 0, 6, 1);
        mov(8, 0, 7, 0, 7, 1);
        mov(8, 0, 7, 0, 7, 1);
        mov(6, 1, 7, 1, 7, 2);
        mov(7, 1, 6, 1, 6, 2);
        
        mov(5, 2, 6, 2, 6, 3);
        mov(8, 2, 7, 2, 7, 3);
        if(n <= 3){
            print();
            continue;
        }
        mov(6, 3, 7, 3, 7, 4);
        print();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

input:

1
1

output:

39
0 -3 1 -3 1 -2 
3 -3 2 -3 2 -2 
4 -3 5 -3 5 -2 
7 -3 6 -3 6 -2 
8 -3 9 -3 9 -2 
11 -3 10 -3 10 -2 
12 -3 13 -3 13 -2 
15 -3 14 -3 14 -2 
0 -2 1 -2 1 -1 
1 -2 2 -2 2 -1 
2 -2 3 -2 3 -1 
5 -2 4 -2 4 -1 
6 -2 5 -2 5 -1 
7 -2 6 -2 6 -1 
8 -2 9 -2 9 -1 
9 -2 10 -2 10 -1 
10 -2 11 -2 11 -1 
13 -2 12 -2...

result:

ok Output is valid. OK

Test #2:

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

input:

6
1
2
3
4
5
6

output:

39
0 -3 1 -3 1 -2 
3 -3 2 -3 2 -2 
4 -3 5 -3 5 -2 
7 -3 6 -3 6 -2 
8 -3 9 -3 9 -2 
11 -3 10 -3 10 -2 
12 -3 13 -3 13 -2 
15 -3 14 -3 14 -2 
0 -2 1 -2 1 -1 
1 -2 2 -2 2 -1 
2 -2 3 -2 3 -1 
5 -2 4 -2 4 -1 
6 -2 5 -2 5 -1 
7 -2 6 -2 6 -1 
8 -2 9 -2 9 -1 
9 -2 10 -2 10 -1 
10 -2 11 -2 11 -1 
13 -2 12 -2...

result:

ok Output is valid. OK

Extra Test:

score: 0
Extra Test Passed