QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#694610#7619. Make SYSU Great Again IdiguoWA 0ms3760kbC++231.1kb2024-10-31 18:19:132024-10-31 18:19:14

Judging History

This is the latest submission verdict.

  • [2024-10-31 18:19:14]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3760kb
  • [2024-10-31 18:19:13]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, y) for (int i = x; i <= y; ++i)
#define per(i, x, y) for (int i = x; i >= y; --i)
#define ll long long
#define pii pair<int, int>
inline ll read()
{
    ll x = 0, f = 1; char ch = getchar();
    while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
    while (isdigit(ch)) {x = x * 10 + ch - 48; ch = getchar();}
    return x * f;
}
void solve()
{
    int n = read(), k = read();
    map<pii, bool> mp;
    auto go = [&](int x, int y)
    {
        mp[{x, y}] = 1;
        cout << x << ' ' << y << '\n';
    };
    go(1, 1), go(1, n);
    per(i, n, 2)
    {
        go(i, i);
        go(i, i - 1);
    }
    int x = 1, y = 1;
    auto find = [&]()
    {
        while (mp[{x, y}])
        {
            if (y == n)
            {
                y == 1;
                x += 1;
            }
            else ++y;
        }
        go(x, y);
    };
    rep(i, 2 * n + 1, k) find();

}
int main()
{
    int t = 1;
    while (t--)
    {
        solve();
        putchar('\n');
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 6

output:

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


result:

ok The answer is correct.

Test #2:

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

input:

3 7

output:

1 1
1 3
3 3
3 2
2 2
2 1
1 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: -100
Wrong Answer
time: 0ms
memory: 3760kb

input:

3 9

output:

1 1
1 3
3 3
3 2
2 2
2 1
1 2
2 3
4 3


result:

wrong answer Integer 4 violates the range [1, 3]