QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619208 | #5275. Joking? | TokaiZaopen | WA | 1ms | 3608kb | C++20 | 964b | 2024-10-07 13:30:22 | 2024-10-07 13:30:26 |
Judging History
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%