QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304527#7619. Make SYSU Great Again IDetachWA 1ms3492kbC++171.4kb2024-01-13 20:49:572024-01-13 20:49:57

Judging History

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

  • [2024-01-13 20:49:57]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3492kb
  • [2024-01-13 20:49:57]
  • 提交

answer

#include <bits/stdc++.h>
// #include <algorithm>
// #include <queue>
// #include <map>
// #include <iostream>
// #include <string>
// #include <set>
#define endl '\n'

using namespace std;

using LL = long long;
using PII = pair<int, int>;
using i128 = __int128_t;
using ULL = unsigned long long;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7, N = 1e6 + 5;
const LL LINF = 0x3f3f3f3f3f3f3f3f;

void solve()
{
    int n, k;
    cin >> n >> k;

    map<PII, bool> mp;
    int x = 0, y = 0;
    vector<PII> ans;
    for(int i = 0; i < 2 * n - 1; i ++ )
    {
        ans.push_back({x, y});
        mp[{x, y}] = true;

        if(i % 2 == 0) y ++ ;
        else x ++ ;

        if(y == n) x ++ ;
        x %= n, y %= n;
    }

    if(n % 2) mp[{n - 1, n - 2}] = true, ans.push_back({n - 1, n - 2});
    else mp[{x - 2, n - 1}] = true, ans.push_back({n - 2, n - 1});

    x = 0, y = 0;
    for(int i = 2 * n; i < k; i ++ )
    {
        while(mp[{x, y}])
        {
            y ++ ;
            if(y == n) x ++ ;
            x %= n, y %= n;
        }

        mp[{x, y}] = true;
        ans.push_back({x, y});
    }

    for(auto [x, y] : ans) cout << x + 1 << ' ' << y + 1 << endl;
}   

int main()
{
    // freopen("galactic.in", "r", stdin);
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int T = 1; 
    // cin >> T;

    while(T -- )
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 6

output:

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

result:

wrong answer The answer is wrong: There are fewer than two numbers in one row or column