Task: | Split in Three |
Sender: | dxz05 |
Submission time: | 2021-01-30 10:43:38 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 22 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 22 |
#2 | WRONG ANSWER | 0 |
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 | WRONG ANSWER | 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 |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:116:20: warning: statement has no effect [-Wunused-value] debug(test); ^
Code
//#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << "[" << H << "]"; debug_out(T...); } #ifdef dddxxz #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif #define SZ(s) ((int)s.size()) clock_t startTime; double getCurrentTime() { return (double) (clock() - startTime) / CLOCKS_PER_SEC; } typedef long long ll; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); const double eps = 0.00001; const int MOD = 1e9 + 7; const int INF = 1000000101; const long long LLINF = 1223372000000000555; const int N = 1e6 + 3e1; const int M = 1111; vector<int> A, B, C; int ans[N]; void out(){ int n = A.size() + B.size() + C.size(); for (int i : A) ans[i] = 1; for (int i : B) ans[i] = 2; for (int i : C) ans[i] = 3; for (int i = 1; i <= n; i++) cout << ans[i] << ' '; exit(0); } void solve(int TC) { int n; cin >> n; if (n * (n + 1) % 6 != 0 || n == 2){ cout << "IMPOSSIBLE"; return; } if (n % 6 == 0){ A = {1, 5}, B = {3, 4}, C = {2, 6}; for (int i = 7; i <= n; i++){ if (i % 6 == 1 || i % 6 == 0) A.push_back(i); if (i % 6 == 2 || i % 6 == 5) B.push_back(i); if (i % 6 == 3 || i % 6 == 4) C.push_back(i); } out(); } if (n % 6 == 2){ A = {1, 3, 7}, B = {4, 8}, C = {2, 5, 6}; for (int i = 9; i <= n; i++){ if (i % 6 == 3 || i % 6 == 2) A.push_back(i); if (i % 6 == 4 || i % 6 == 1) B.push_back(i); if (i % 6 == 5 || i % 6 == 0) C.push_back(i); } out(); } if (n % 6 == 3){ A = {1}, B = {2}, C = {3}; for (int i = 4; i <= n; i++){ if (i % 6 == 4 || i % 6 == 3) A.push_back(i); if (i % 6 == 5 || i % 6 == 2) B.push_back(i); if (i % 6 == 0 || i % 6 == 1) C.push_back(i); } out(); } if (n % 6 == 5){ A = {1, 3}, B = {5}, C = {2, 4}; for (int i = 6; i <= n; i++){ if (i % 6 == 0 || i % 6 == 5) A.push_back(i); if (i % 6 == 1 || i % 6 == 3) B.push_back(i); if (i % 6 == 2 || i % 6 == 3) C.push_back(i); } out(); } } int main() { startTime = clock(); ios_base::sync_with_stdio(false); bool llololcal = false; #ifdef dddxxz freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); llololcal = true; #endif int TC = 1; //cin >> TC; for (int test = 1; test <= TC; test++) { debug(test); solve(test); } if (llololcal) cerr << endl << "Time: " << getCurrentTime() * 1000 << " ms" << endl; 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 |
---|
1 3 2 2 1 3 |
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 |
---|
1 3 1 2 3 3 1 2 |
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 1 2 3 3 2 1 |
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 |
---|
1 3 2 2 1 3 1 2 3 3 2 1 1 2 3 ... |
Test 10
Group: 2
Verdict: WRONG ANSWER
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 0 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 |
---|
1 3 2 2 1 3 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 |
---|
1 3 1 2 3 3 1 2 1 2 3 3 2 1 1 ... 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 1 2 3 3 2 1 1 2 3 3 2 1 ... Truncated |
Test 15
Group: 2
Verdict: ACCEPTED
input |
---|
100 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |