QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#247278#7619. Make SYSU Great Again Iucup-team1001#WA 0ms3752kbC++201.2kb2023-11-11 13:53:372023-11-11 13:53:41

Judging History

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

  • [2023-11-11 13:53:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3752kb
  • [2023-11-11 13:53:37]
  • 提交

answer

//
// Created by DELLPC on 2023/11/10.
//
#include<bits/stdc++.h>

using namespace std;
#define ll long long
unordered_set<ll>s;
int n, k, cur;
ll tot, xx, yy;
ll get (ll x, ll y){
    return (x - 1) * n + y - 1;
}
void append(int x, int y){
    cout << x << ' ' << y << '\n';
    s.insert(get(x, y));
}

void get_xy(){
    while(s.contains(tot))++ tot;
    xx = tot / n + 1, yy = (tot % n) + 1;
}

int main(){
    cin >> n >> k;
    if(n & 1){
        append(1, 1);
        append(1, 2);
        append(2, 2);
        append(2, 3);
        append(3, 3);
        append(3, 1);
        int res = k - 6;
        for(int i = 4; i <= n; i += 2){
            append(i, i);
            append(i, i + 1);
            append(i + 1, i + 1);
            append(i + 1, i);
            res -= 4;
        }
        while(res --){
            get_xy();
            append(xx, yy);
        }
    }else{
        int res = k;
        for(int i = 1; i <= n; i += 2){
            append(i, i);
            append(i, i + 1);
            append(i + 1, i + 1);
            append(i + 1, i);
            res -= 4;
        }
        while(res --){
            get_xy();
            append(xx, yy);
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3580kb

input:

3 7

output:

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

result:

ok The answer is correct.

Test #3:

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

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: 3752kb

input:

3 9

output:

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

result:

ok The answer is correct.

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3560kb

input:

10 20

output:

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

result:

wrong answer The answer is wrong: The maximum common divisor of row 5 and column -1436281728 is not the same.