QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#666336#7619. Make SYSU Great Again IMiniLongWA 0ms5752kbC++143.4kb2024-10-22 17:54:572024-10-22 17:54:57

Judging History

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

  • [2024-10-22 17:54:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5752kb
  • [2024-10-22 17:54:57]
  • 提交

answer

#include <bits/stdc++.h>
#define _rep(i, x, y) for(int i = x; i <= y; ++i)
#define _req(i, x, y) for(int i = x; i >= y; --i)
#define _rev(i, u) for(int i = head[u]; i; i = e[i].nxt)
#define pb push_back
#define fi first
#define se second
#define mst(f, i) memset(f, i, sizeof f)
using namespace std;
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
typedef long long ll;
typedef pair<int, int> PII;
namespace fastio{
    #ifdef ONLINE_JUDGE
    char ibuf[1 << 20],*p1 = ibuf, *p2 = ibuf;
    #define get() p1 == p2 && (p2 = (p1 = ibuf) + fread(ibuf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++
    #else
    #define get() getchar()
    #endif
    template<typename T> inline void read(T &t){
        T x = 0, f = 1;
        char c = getchar();
        while(!isdigit(c)){
            if(c == '-') f = -f;
            c = getchar();
        }
        while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
        t = x * f;
    }
    template<typename T, typename ... Args> inline void read(T &t, Args&... args){
        read(t);
        read(args...);
    }
    template<typename T> void write(T t){
        if(t < 0) putchar('-'), t = -t;
        if(t >= 10) write(t / 10);
        putchar(t % 10 + '0');
    }
    template<typename T, typename ... Args> void write(T t, Args... args){
        write(t), putchar(' '), write(args...);
    }
    template<typename T> void writeln(T t){
        write(t);
        puts("");
    }
    template<typename T> void writes(T t){
        write(t), putchar(' ');
    }
    #undef get
};
using namespace fastio;
#define multitest() int T; read(T); _rep(tCase, 1, T)
namespace Calculation{
    const ll mod = 998244353;
    ll ksm(ll p, ll h){ll base = p % mod, res = 1; while(h){if(h & 1ll) res = res * base % mod; base = base * base % mod, h >>= 1ll;} return res;}
    void dec(ll &x, ll y){x = ((x - y) % mod + mod) % mod;}
    void add(ll &x, ll y){x = (x + y) % mod;}
    void mul(ll &x, ll y){x = x * y % mod;}
    ll sub(ll x, ll y){return ((x - y) % mod + mod) % mod;}
    ll pls(ll x, ll y){return ((x + y) % mod + mod) % mod;}
    ll mult(ll x, ll y){return x * y % mod;}
}
using namespace Calculation;
const int N = 2e5 + 5, M = 1e6 + 5;
int n, k;
PII a[N];
map<PII, bool> vis;
int main(){
    read(n, k);
    if(n % 2 == 0){
        _rep(i, 1, n / 2){
            a[2 * i - 1] = {i, 2 * i - 1};
            a[2 * i] = {i, 2 * i};
            a[2 * i - 1 + n] = {i + n / 2, 2 * i};
            a[2 * i + n] = {i + n / 2, 2 * i - 1};
        }
    }else{
        if(n == 3){
            a[1] = {1, 1}, a[2] = {1, 2}, a[3] = {2, 2}, a[4] = {2, 3}, a[5] = {3, 3}, a[6] = {3, 1};
        }else{
            _rep(i, 1, n / 2){
                a[2 * i - 1] = {i, 2 * i - 1};
                a[2 * i] = {i, 2 * i};
                a[2 * i + n] = {i + n / 2 + 1, 2 * i};
                a[2 * i + n + 1] = {i + n / 2 + 1, 2 * i + 1};
            }
            a[n] = {n / 2 + 1, n}, a[n + 1] = {n / 2 + 1, 1};
            swap(a[2 * n], a[2 * n - 2]);
        }
    }
    _rep(i, 1, 2 * n) vis[{a[i].fi, a[i].se}] = 1;
    int cnt = 2 * n;
    _rep(i, 1, n){
        _rep(j, 1, n){
            if(cnt > k) break;
            if(vis[{i, j}]) continue;
            a[++cnt] = {i, j};
        }
        if(cnt > k) break;
    }
    _rep(i, 1, k) write(a[i].fi, a[i].se), puts("");
    return 0;
}

详细

Test #1:

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

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

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

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

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

input:

10 20

output:

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

result:

wrong answer The answer is wrong: The maximum common divisor of row 6 and column 483382400 is not the same.