QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#619208#5275. Joking?TokaiZaopenWA 1ms3608kbC++20964b2024-10-07 13:30:222024-10-07 13:30:26

Judging History

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

  • [2024-10-07 13:30:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2024-10-07 13:30:22]
  • 提交

answer

#include <bits/stdc++.h>

#define int ll
using ll = long long;

using namespace std;

int n;
int m;
vector<int> ans[10];

void solve();

signed main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}

void solve()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        ans[i].clear();
    m = 1;
    for (int i = 1; i <= n; i++)
        m *= i;
    vector<int> now;
    for (int i = 0; i <= n - 1; i++)
        now.push_back(i);

    int bonus = 1;
    do
    {
        for (int i = 0; i < n; i++)
        {
            ans[i].push_back(now[i] + bonus);
        }
        bonus += n;
    } while (next_permutation(now.begin(), now.end()));

    cout << m << '\n';
    for (int i = 1; i <= n; i++)
    {
        for (auto it : ans[i - 1])
        {
            cout << it << " ";
        }
        cout << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3608kb

input:

2

output:

2
1 4 
2 3 

result:

ok n = 2, max_relative_diff = 0.000%

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3540kb

input:

3

output:

6
1 4 8 11 15 18 
2 6 7 12 13 17 
3 5 9 10 14 16 

result:

wrong answer n = 3, max_relative_diff = 33.333%