CSES - Datatähti Open 2021 - Results
Submission details
Task:Split in Three
Sender:Sasha008
Submission time:2021-01-30 16:40:42 +0200
Language: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
#80.01 s1, 2details
#9ACCEPTED0.01 s2details
#10ACCEPTED0.01 s2details
#11ACCEPTED0.01 s2details
#120.01 s2details
#13ACCEPTED0.01 s2details
#14ACCEPTED0.01 s2details
#150.01 s2details

Code

#include<bits/stdc++.h>
#define x fwfwFwf1
#define y fwfwFwf2
using namespace std;
long long a,b,c,d,n,m,i,f,g,i2,j2,f1,f2,j,k,l,o,p,t,y,mx,mx1,mx2,q,q1,q2,r,mn=1e18,mn1=1e18,mn2=1e18,MOD=1e9+7;
long long A[2000006];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    if (n==3) {cout<<"1 2 3";return 0;}
    f=n*(n+1)/2;
    f/=3;
    f--;
    for(i=n;i>=3;i--)
    {
        if (A[i]==0)
        {
            if (i<=f) {f-=i;A[i]=2;}
        }
    }
    if (f!=0) {cout<<"IMPOSSIBLE";return 0;}
    f=n*(n+1)/2;
    f/=3;
    f--;
    for(i=n;i>=3;i--)
    {
        if (A[i]==0)
        {
            if (i<=f) {f-=i;A[i]=1;}
        }
    }
    if (f!=0) {cout<<"IMPOSSIBLE";return 0;}
    A[1]=2;
    A[2]=3;
    for(i=1;i<=n;i++)
    {
        if (A[i]==0) A[i]=3;
        cout<<A[i]<<" ";
    }
}

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
IMPOSSIBLE

Test 4

Group: 1, 2

Verdict:

input
6

correct output
1 3 2 2 1 3 

user output
IMPOSSIBLE

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 2 1 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
2 3 3 3 2 1 3 1 2 

Test 8

Group: 1, 2

Verdict:

input
10

correct output
IMPOSSIBLE

user output
2 3 3 3 3 3 2 1 1 2 

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 3 3 3 3 3 3 3 3 3 3 3 3 3 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
2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

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

Test 12

Group: 2

Verdict:

input
97

correct output
IMPOSSIBLE

user output
2 3 3 3 3 3 3 3 1 3 3 3 3 3 3 ...

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 3 2 3 3 3 3 3 3 3 3 3 3 ...

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
2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

Test 15

Group: 2

Verdict:

input
100

correct output
IMPOSSIBLE

user output
2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...