QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#404321#5528. Least Annoying Constructive Problemucup-team173WA 1ms3916kbC++201.2kb2024-05-03 19:46:052024-05-03 19:46:06

Judging History

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

  • [2024-05-03 19:46:06]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3916kb
  • [2024-05-03 19:46:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back
#define SZ(a) (int(a.size()))

typedef long long ll;
typedef double db;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
std::mt19937_64 gen(std::chrono::system_clock::now().time_since_epoch().count());
ll get(ll l, ll r) { std::uniform_int_distribution<ll> dist(l, r); return dist(gen); }

void solve() {
    int n;
    cin >> n;
    if(n % 2) {
        int k = n / 2;
        for(int i = 0; i < n; i++)
            for(int j = 1; j <= k; j++)
                cout << (i - j + 1 + n) % n + 1 << ' ' << (i + j) % n + 1 << '\n';
    } else {
        n--;
        int k = n / 2;
        for(int i = 0; i < n; i++) {
            for(int j = 1; j <= k; j++)
                cout << (i - j + 1 + n) % n + 1 << ' ' << (i + j) % n + 1 << '\n';
            cout << (i + k + 1) % n + 1 << ' ' << 2 * k + 2 << '\n';
        }
    }
}
signed main() {
    atexit([](){cerr << "time: " << (db)clock()/CLOCKS_PER_SEC << "s\n";});
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

详细

Test #1:

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

input:

3

output:

1 2
2 3
3 1

result:

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