| Task: | Permutaatio |
| Sender: | Kemm1706 |
| Submission time: | 2025-01-18 16:59:25 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #4 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #5 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
| #6 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #7 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #8 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #9 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #10 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #11 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #16 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #17 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #18 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #19 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #20 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #21 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #22 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #23 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:44:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | if(k == x.size())
| ~~^~~~~~~~~~~
input/code.cpp:49:25: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} [-Wsign-compare]
49 | if(x.size() != inc[i])
input/code.cpp:54:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | if(k == y.size())
| ~~^~~~~~~~~~~
input/code.cpp:58:25: warning: comparison of integer exp...Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector <ll> vl;
typedef vector <vl> vvl;
typedef pair <ll, ll> pl;
typedef vector <pl> vpl;
typedef stack <ll> stl;
typedef set <ll> sl;
#define fi first
#define se second
void out(const vl &a)
{
for(auto x : a)
cerr << x << " ";
cerr << "\n";
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
ll n, i, j, k;
cin >> n;
vl inc(n + 2), dec(n + 2);
for(i = 1; i <= n; i++)
cin >> inc[i];
for(i = 1; i <= n; i++)
cin >> dec[i];
vl a(n); iota(a.begin(), a.end(), -n + 1);
do
{
vl x, y;
for(i = 0; i < n; i++)
{
x.push_back(a[i]); y.push_back(a[i]);
for(j = i - 1; j >= 0; j--)
{
k = lower_bound(x.begin(), x.end(), a[j]) - x.begin();
if(k == x.size())
x.push_back(a[j]);
if(k != 0)
x[k] = a[j];
}
if(x.size() != inc[i])
break;
for(j = i + 1; j < n; j++)
k = lower_bound(y.begin(), y.end(), a[j]) - y.begin();
if(k == y.size())
y.push_back(a[j]);
if(k != 0)
y[k] = a[j];
if(y.size() != dec[i])
break;
}
if(i == n)
break;
}while(next_permutation(a.begin(), a.end()));
if(!next_permutation(a.begin(), a.end()))
cout << "IMPOSSIBLE";
else
for(i = 0; i < n; i++)
cout << -a[i] + 1 << " ";
return 0;
}
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 1 1 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| IMPOSSIBLE |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 2 1 1 1 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 1 2 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 1 3 3 2 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 3 1 2 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 3 2 2 1 3 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 3 1 2 |
Test 5
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 5 1 2 3 4 5 2 1 1 1 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 5 4 3 1 2 |
Test 6
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 2 2 3 2 3 4 5 1 3 2 2 1 1 1 1 |
| correct output |
|---|
| 1 8 5 7 2 3 4 6 |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 7
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 2 2 2 1 3 2 1 3 5 4 3 2 3 2 1 |
| correct output |
|---|
| 3 8 6 5 2 7 4 1 |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 8
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 9
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 1 1 1 1 1 1 1 8 7 6 5 4 3 2 1 |
| correct output |
|---|
| 8 7 6 5 4 3 2 1 |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 10
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 11
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 2 2 3 4 4 5 4 6 4 7 8 5 7 9 ... |
| correct output |
|---|
| 25 205 54 76 500 218 316 181 3... |
| user output |
|---|
| (empty) |
Test 12
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 2 3 1 1 2 2 4 1 3 5 3 3 3 4 ... |
| correct output |
|---|
| 336 388 404 309 233 377 240 42... |
| user output |
|---|
| (empty) |
Test 13
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 14
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 500 499 498 497 496 495 494 49... |
| user output |
|---|
| (empty) |
Test 15
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 16
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 2 2 3 2 1 3 3 2 4 2 3 5 4 5 ... |
| correct output |
|---|
| 12162 165274 130162 168624 391... |
| user output |
|---|
| (empty) |
Test 17
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1 2 3 3 2 4 3 4 5 2 5 6 7 3 ... |
| correct output |
|---|
| 191389 13806 133836 173924 159... |
| user output |
|---|
| (empty) |
Test 18
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 19
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 200000 199999 199998 199997 19... |
| user output |
|---|
| (empty) |
Test 20
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 21
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 8 1 1 2 1 2 3 1 3 4 3 3 2 2 3 1 1 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 8 7 6 5 4 3 1 2 |
Test 22
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 1 2 3 2 1 2 1 2 3 3 3 3 4 1 5 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
Test 23
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1 1 2 2 3 1 3 4 1 5 4 2 5 6 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| (empty) |
