QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#266781#7619. Make SYSU Great Again IMarch_April#TL 0ms3756kbC++20822b2023-11-26 17:36:532023-11-26 17:36:53

Judging History

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

  • [2023-11-26 17:36:53]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3756kb
  • [2023-11-26 17:36:53]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    vector<pair<int, int>> res;
    
    int j = 0;
    vector<vector<int>> st(n + 1, vector<int> (n + 1));
    for(int i = 1;i <= n; i ++)
    {
        res.push_back({i, i});
        if(i != n)
        res.push_back({i, i + 1}), st[i][i + 1] = true;
        else    
            res.push_back({i, 1}),  st[i][1] = true;
        st[i][i] = 1;
    }

    vector<pair<int, int>> nop;
    for(int i = 1;i <= n; i ++)
        for(int j = 1;j <= n; j ++)
            if(!st[i][j])   nop.push_back({i, j});
    

    while(res.size() < k)
    {
        res.push_back(nop.back());
        nop.pop_back();
    }

    for(auto [x, y] : res)
        cout << x << ' ' << y << '\n';
    return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 6

output:

1 1
1 2
2 2
2 3
3 3
3 1

result:

ok The answer is correct.

Test #2:

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

input:

3 7

output:

1 1
1 2
2 2
2 3
3 3
3 1
3 2

result:

ok The answer is correct.

Test #3:

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

input:

2 4

output:

1 1
1 2
2 2
2 1

result:

ok The answer is correct.

Test #4:

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

input:

3 9

output:

1 1
1 2
2 2
2 3
3 3
3 1
3 2
2 1
1 3

result:

ok The answer is correct.

Test #5:

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

input:

10 20

output:

1 1
1 2
2 2
2 3
3 3
3 4
4 4
4 5
5 5
5 6
6 6
6 7
7 7
7 8
8 8
8 9
9 9
9 10
10 10
10 1

result:

ok The answer is correct.

Test #6:

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

input:

10 100

output:

1 1
1 2
2 2
2 3
3 3
3 4
4 4
4 5
5 5
5 6
6 6
6 7
7 7
7 8
8 8
8 9
9 9
9 10
10 10
10 1
10 9
10 8
10 7
10 6
10 5
10 4
10 3
10 2
9 8
9 7
9 6
9 5
9 4
9 3
9 2
9 1
8 10
8 7
8 6
8 5
8 4
8 3
8 2
8 1
7 10
7 9
7 6
7 5
7 4
7 3
7 2
7 1
6 10
6 9
6 8
6 5
6 4
6 3
6 2
6 1
5 10
5 9
5 8
5 7
5 4
5 3
5 2
5 1
4 10
4 9
4 8...

result:

ok The answer is correct.

Test #7:

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

input:

32 64

output:

1 1
1 2
2 2
2 3
3 3
3 4
4 4
4 5
5 5
5 6
6 6
6 7
7 7
7 8
8 8
8 9
9 9
9 10
10 10
10 11
11 11
11 12
12 12
12 13
13 13
13 14
14 14
14 15
15 15
15 16
16 16
16 17
17 17
17 18
18 18
18 19
19 19
19 20
20 20
20 21
21 21
21 22
22 22
22 23
23 23
23 24
24 24
24 25
25 25
25 26
26 26
26 27
27 27
27 28
28 28
28 29...

result:

ok The answer is correct.

Test #8:

score: -100
Time Limit Exceeded

input:

200000 400000

output:


result: