Task: | Split in Three |
Sender: | endagorion |
Submission time: | 2021-01-31 07:58:05 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 22 |
#2 | ACCEPTED | 78 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 1, 2 | details |
#3 | ACCEPTED | 0.01 s | 1, 2 | details |
#4 | ACCEPTED | 0.01 s | 1, 2 | details |
#5 | ACCEPTED | 0.01 s | 1, 2 | details |
#6 | ACCEPTED | 0.01 s | 1, 2 | details |
#7 | ACCEPTED | 0.01 s | 1, 2 | details |
#8 | ACCEPTED | 0.01 s | 1, 2 | details |
#9 | ACCEPTED | 0.01 s | 2 | details |
#10 | ACCEPTED | 0.01 s | 2 | details |
#11 | ACCEPTED | 0.01 s | 2 | details |
#12 | ACCEPTED | 0.01 s | 2 | details |
#13 | ACCEPTED | 0.01 s | 2 | details |
#14 | ACCEPTED | 0.01 s | 2 | details |
#15 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i) #define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) using namespace std; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector<vi> vvi; typedef long long i64; typedef vector<i64> vi64; typedef vector<vi64> vvi64; typedef pair<i64, i64> pi64; typedef double ld; template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; } template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(10); cout << fixed; #ifdef LOCAL_DEFINE freopen("input.txt", "rt", stdin); #endif int n; cin >> n; if (n % 3 == 1) { cout << "IMPOSSIBLE\n"; return 0; } vi ans(n, -1); if (n % 3 == 2) ans.pb(-1); forn(i, ans.size()) ans[i] = (i / 3 % 2 == 0 ? i % 3 : 2 - i % 3); if (ans.size() % 2 == 0) { vi pref = {1, 0, 2, 0, 2, 1}; forn(i, 6) ans[i] = pref[i]; } if (n % 3 == 2) ans.erase(ans.begin()); forn(i, ans.size()) cout << ans[i] + 1 << ' '; cout << '\n'; #ifdef LOCAL_DEFINE cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
1 2 3 |
user output |
---|
1 2 3 |
Test 2
Group: 1, 2
Verdict: ACCEPTED
input |
---|
4 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 3
Group: 1, 2
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
1 3 1 3 2 |
user output |
---|
1 3 1 3 2 |
Test 4
Group: 1, 2
Verdict: ACCEPTED
input |
---|
6 |
correct output |
---|
1 3 2 2 1 3 |
user output |
---|
2 1 3 1 3 2 |
Test 5
Group: 1, 2
Verdict: ACCEPTED
input |
---|
7 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 6
Group: 1, 2
Verdict: ACCEPTED
input |
---|
8 |
correct output |
---|
2 3 1 2 3 3 2 1 |
user output |
---|
2 3 3 2 1 1 2 3 |
Test 7
Group: 1, 2
Verdict: ACCEPTED
input |
---|
9 |
correct output |
---|
1 2 3 1 2 3 3 2 1 |
user output |
---|
1 2 3 3 2 1 1 2 3 |
Test 8
Group: 1, 2
Verdict: ACCEPTED
input |
---|
10 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 9
Group: 2
Verdict: ACCEPTED
input |
---|
42 |
correct output |
---|
1 3 2 2 1 3 1 2 3 3 2 1 1 2 3 ... |
user output |
---|
2 1 3 1 3 2 1 2 3 3 2 1 1 2 3 ... |
Test 10
Group: 2
Verdict: ACCEPTED
input |
---|
95 |
correct output |
---|
1 3 1 3 2 1 2 3 3 2 1 1 2 3 3 ... |
user output |
---|
1 3 1 3 2 1 2 3 3 2 1 1 2 3 3 ... Truncated |
Test 11
Group: 2
Verdict: ACCEPTED
input |
---|
96 |
correct output |
---|
1 3 2 2 1 3 1 2 3 3 2 1 1 2 3 ... |
user output |
---|
2 1 3 1 3 2 1 2 3 3 2 1 1 2 3 ... Truncated |
Test 12
Group: 2
Verdict: ACCEPTED
input |
---|
97 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 13
Group: 2
Verdict: ACCEPTED
input |
---|
98 |
correct output |
---|
2 3 1 2 3 3 2 1 1 2 3 3 2 1 1 ... |
user output |
---|
2 3 3 2 1 1 2 3 3 2 1 1 2 3 3 ... Truncated |
Test 14
Group: 2
Verdict: ACCEPTED
input |
---|
99 |
correct output |
---|
1 2 3 1 2 3 3 2 1 1 2 3 3 2 1 ... |
user output |
---|
1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 ... Truncated |
Test 15
Group: 2
Verdict: ACCEPTED
input |
---|
100 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |