QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#364142#8309. Mountainucup-team173#WA 0ms3552kbC++201.9kb2024-03-24 12:22:582024-03-24 12:22:58

Judging History

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

  • [2024-03-24 12:22:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-03-24 12:22:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))

typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void solve() {
    ll n, d, c;
    cin >> n >> d >> c;
    if(d == 0) {
        if(n == c) {
            cout << "Yes\n";
            for(int i = 1; i <= n; i++)
                cout << '\n';
        } else {
            cout << "No\n";
        }
        return;
    }
    if(d == 1) {
        if(n % 2 || c != n / 2) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
            for(int i = 1; i <= n; i++) {
                if(i % 2) cout << i + 1;
                else cout << i - 1;
                cout << '\n';
            }
        }
        return;
    }
    if(c * (d + 1) > n || n * d % 2) {
        cout << "No\n";
        return;
    }
    ll lst = n - (c - 1) * (d + 1);
    vector G(n, vi());
    auto add = [&](int x, int y) {
        G[x].pb(y), G[y].pb(x);
    };
    for(int t = lst; t < n; t += d + 1) {
        for(int i = 0; i < d + 1; i++) {
            for(int j = 1; j <= d; j++) {
                G[i + t].pb((t + (i + j) % (d + 1)));
            }
        }
    }
    for(int t = 1; t <= d / 2; t++) {
        for(int i = 0; i < lst; i++) {
            add(i, (i + t) % lst);
        }
    }
    if(d % 2) {
        assert(lst % 2 == 0);
        for(int i = 0; i < lst / 2; i++) {
            add(i, i + lst / 2);
        }
    }
    cout << "Yes\n";
    for(int i = 0; i < n; i++) {
        sort(G[i].begin(), G[i].end());
        for(int j : G[i]) cout << j + 1 << ' ';
        cout << '\n';
    }
}
signed main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

3 1 2
2 1 3

output:

No

result:

wrong output format Expected double, but "No" found