QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#100855#1807. Distribute the Barsckiseki#WA 2ms3320kbC++201.0kb2023-04-28 14:01:532023-04-28 14:01:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-28 14:01:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3320kb
  • [2023-04-28 14:01:53]
  • 提交

answer

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

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n; cin >> n;
    if (n % 2 == 0) {
        cout << n / 2 << '\n';
        for (int i = 0; i < n / 2; ++i) {
            cout << 2 << ' ' << 2 * i + 1 << ' ' << 2 * (n - i - 1) + 1 << '\n';
        }
        return 0;
    }
    for (int i = 2; i * i <= n; ++i) {
        if (n % i != 0) continue;
        auto v = vector(n / i, vector(i, 0));
        for (int x = 0; x < i; ++x)
            for (int y = 0; y < i; ++y)
                v[x][(x+y)%i] = y;
        for (int x = i; x < n / i; x += 2) {
            for (int y = 0; y < i; ++y) {
                v[x][y] = y;
                v[x + 1][i - y - 1] = y;
            }
        }
        cout << i << '\n';
        for (int x = 0; x < i; ++x) {
            cout << n / i;
            for (int y = 0; y < n / i; ++y) {
                cout << ' ' << 2 * v[y][x] + 1 + i * y * 2;
            }
            cout << '\n';
        }
        return 0;
    }
    cout << -1 << '\n';
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3320kb

input:

4

output:

2
2 1 7
2 3 5

result:

ok OK (2 groups)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3320kb

input:

2

output:

1
2 1 3

result:

wrong answer M=1 is too small