CSES - Datatähti Open 2021 - Results
Submission details
Task:Split in Three
Sender:vixephor
Submission time:2021-01-31 10:19:09 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s1, 2details
#30.01 s1, 2details
#40.01 s1, 2details
#5ACCEPTED0.01 s1, 2details
#6ACCEPTED0.01 s1, 2details
#7ACCEPTED0.01 s1, 2details
#8ACCEPTED0.01 s1, 2details
#9ACCEPTED0.01 s2details
#10ACCEPTED0.01 s2details
#11ACCEPTED0.01 s2details
#12ACCEPTED0.01 s2details
#13ACCEPTED0.01 s2details
#14ACCEPTED0.01 s2details
#15ACCEPTED0.01 s2details

Code

/*
Почему ты смотришь v мой код?
плохо-плохо


=)
*/
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstdarg>
#include <cassert>
#include <climits>
#include <cstring>
#include <complex>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#include <iomanip>
#include <unordered_map>
#include <bitset>
#include<stack>

using namespace std;

#define ll   long long
#define ld   long double
#define int long long

#define mp   make_pair
#define pb   push_back
#define eb   emplace_back

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define int long long
#define pb push_back
template<typename T>             vector<T>& operator--            (vector<T>& v) { for (auto& i : v) --i;            return  v; }
template<typename T>             vector<T>& operator++            (vector<T>& v) { for (auto& i : v) ++i;            return  v; }
template<typename T>             istream& operator>>(istream& is, vector<T>& v) { for (auto& i : v) is >> i;        return is; }
template<typename T>             ostream& operator<<(ostream& os, vector<T>& v) { for (auto& i : v) os << i << ' '; return os; }
template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second;        return is; }
template<typename T, typename U> ostream& operator<<(ostream& os, pair<T, U>& p) { os << p.first << ' ' << p.second; return os; }
template<typename T, typename U> pair<T, U> operator-(pair<T, U> a, pair<T, U> b) { return mp(a.first - b.first, a.second - b.second); }
template<typename T, typename U> pair<T, U> operator+(pair<T, U> a, pair<T, U> b) { return mp(a.first + b.first, a.second + b.second); }
template<typename T, typename U> void umin(T& a, U b) { if (a > b) a = b; }
template<typename T, typename U> void umax(T& a, U b) { if (a < b) a = b; }

long long a, b, c, e, f, g;
ll h[1000005];
ll h2[1000005];
ll h3[1000005];

void solve()
{
    cin >> a;
    b = a * (a + 1) / 2;
    if (b % 3 != 0)
    {
        cout << "IMPOSSIBLE\n";
        return;
    }
    b /= 3;
    c = b - 1;
    e = b;
    f = b + 1;
    for (int i = a; i >= 1; i--)
    {
        if (i <= f)
        {
            h[i] = 3;
            f -= i;
        }
    }
    for (int i = a; i >= 1; i--)
    {
        if (h[i] == 0)
        {
            if (i <= e)
            {
                h[i] = 2;
                e -= i;
            }
        }
    }
    for (int i = a; i >= 1; i--)
    {
        if (h[i] == 0)
        {
            if (i <= c)
            {
                h[i] = 1;
                c -= i;
            }
        }
    }
    for (int i = 1; i <= a; i++)
    {
        cout << h[i]<<" ";
    }
}
/*
1
3
2 1000 100
-1 1 1
-1 2 1000
100
1
L
1 2
1
R
2 1
2
LL
1 2 2
2
RR
2 2 1
2
LR
1 5 1

*/
signed main() {
    int q;
    q = 1;
   // cin >> q;
    while (q != 0)
    {
        solve();
        q--;
    }
}
/*
0 4 10 16 28 43 0 -4 -10 -16 -28 -43
202 210 234 270 366 516 202 210 234 270 366 516
-1 3 9 15 27 42 1 -3 -9 -15 -27 -42
2252
154 154 162 162 174 174 186 186 210 210 240 240
154 162 174 186 210 240
x1  x2  x3  x4  x5  x6
154=x2*2
162=x1*2
162-154=(x1*2)-(x2*2)
8=2*x1+2*x2
8=2*(x1+x2)
4=x1-x2;
174-162=(x2*2)-(x3*2)
6=x2-x3;

40 56 48 40 80 56 80 48
40 48 56 80

1 5 9 21
64 48 48 96

x1-x2=4
x3-x2=4
x4-x3=12

0 4 10 16 28 43
1 7 9 10 19 37 73 145 289
         17 33 65 129 257
         13 19 31 55



2x-y=0;
    1-2=0
bbccacbс
bbcacaa
aabbaa
yyyyxyyy = 14

xyyyyyyy

*/

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:

input
5

correct output
1 3 1 3 2 

user output
3 0 1 2 3 

Test 4

Group: 1, 2

Verdict:

input
6

correct output
1 3 2 2 1 3 

user output
2 3 0 1 2 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
2 1 1 2 3 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
2 1 1 1 1 2 3 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
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
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 1 1 1 1 1 3 1 1 1 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
Truncated

Test 15

Group: 2

Verdict: ACCEPTED

input
100

correct output
IMPOSSIBLE

user output
IMPOSSIBLE