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

Compiler report

input/code.cpp:7:4: warning: multi-line comment [-Wcomment]
    //                    (\=,      //\\      )__(     /_____\
    ^
input/code.cpp:13:4: warning: multi-line comment [-Wcomment]
    //   |__|    )___(    )___(    /____\    /____\    /_____\
    ^
input/code.cpp: In function 'int main()':
input/code.cpp:108:9: warning: variable 'tab' set but not used [-Wunused-but-set-variable]
   int t,tab;
         ^~~

Code

       
   //                                                  '-.-'
   //                                         ()      __.'.__
   //                                      .-:--:-.  |_______|
   //                               ()      \____/    \=====/
   //                               /\      {====}     )___(
   //                    (\=,      //\\      )__(     /_____\
   //    __    |'-'-'|  //  .\    (    )    /____\     |   |
   //   /  \   |_____| (( \_  \    )__(      |  |      |   |
   //   \__/    |===|   ))  `\_)  /____\     |  |      |   |
   //  /____\   |   |  (/     \    |  |      |  |      |   |
   //   |  |    |   |   | _.-'|    |  |      |  |      |   |
   //   |__|    )___(    )___(    /____\    /____\    /_____\
   //  (====)  (=====)  (=====)  (======)  (======)  (=======)
   //  }===={  }====={  }====={  }======{  }======{  }======={
   // (______)(_______)(_______)(________)(________)(_________)
   //
   // Credits :- Joan G. Stark
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
   //|                      AUTHOR - KASPAROVIAN                                     |
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define frr(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fr first
#define sc second
#define mk make_pair
#define endl '\n'
#define MOD 1000000007
#define in insert
#define sz(x) (ll)(x).size()
#define mem(a,b) memset(a,b,sizeof(a))
//#define int long long
#define runtime() ((double)clock() / CLOCKS_PER_SEC) 
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
#define TRACE 
  
#ifdef TRACE 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 
template <typename Arg1> 
void __f(const char* name, Arg1&& arg1){ 
    cerr << name << " : " << arg1 << endl; 
} 
template <typename Arg1, typename... Args> 
void __f(const char* names, Arg1&& arg1, Args&&... args){ 
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 
} 
#else 
#define trace(...) 
#endif 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
typedef pair<int,pi> ppi;
typedef vector<vi> graph;
template<class T> void mxi(T & a, const T & b) { a = max(a, b); }
template<class T> void mni(T & a, const T & b) { a = min(a, b); }
ld EPS=1e-9;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());  
#define SHUF(v) shuffle(all(v), RNG); 
// Use mt19937_64 for 64 bit random numbers. 
void solve()
{
  int n; cin>>n;
  if(n%3==1)
  {
  	cout<<"IMPOSSIBLE\n"; return ;
  }
  if(n%6==5)
  {
  	string s="1 3 1 3 2 ";
  	for(int i=5;i<n;i+=6)
  	{
  		s+="1 2 3 3 2 1 ";
  	}
  	cout<<s<<endl; return;
  }
  else if(n%6==3)
  {
  	string s="1 2 3 ";
  	for(int i=3;i<n;i+=6)
  	{
  		s+="1 2 3 3 2 1 ";
  	}
  	cout<<s<<endl; return;
  }
  else if(n%6==2)
  {
  	string s="2 3 ";
  	for(int i=2;i<n;i+=6)
  	{
  		s+="1 2 3 3 2 1 ";
  	}
  	cout<<s<<endl; return;
  }
}
signed main()
{
  fast;
  int t,tab;
  t=1;
  tab=t;
  while(t--)
  {
    //cout<<"Case #"<<(tab-t)<<": ";
    solve();
  }
  cerr<<runtime();
}
//APPROACHING A QUESTION
//+ Think of binary search (max of min etc also if n<=2*10^5)
//+ Think of common dp states (Even if it appears as maths but constraints are small)
//+ Check constraints
//+ Keep calm and enjoy the question
//+ Be sure to remove MOD from binpow (if needed)
//+ Try bidirectional analysis for constructive questions
//+ If given some sequence try thinking of prefix sums
//+ If constraints are too large maybe its simple maths
//+ In questions with binary operations think of bits independently and also the change pattern
//+ If two or more binary operations are given mostly there is a relation between them and an arithmatic operator

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
3

correct output
1 2 3 

user output
1 2 3 

Error:
0.001936

Test 2

Group: 1, 2

Verdict: ACCEPTED

input
4

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Error:
0.001812

Test 3

Group: 1, 2

Verdict: ACCEPTED

input
5

correct output
1 3 1 3 2 

user output
1 3 1 3 2 

Error:
0.001966

Test 4

Group: 1, 2

Verdict:

input
6

correct output
1 3 2 2 1 3 

user output
(empty)

Error:
0.001928

Test 5

Group: 1, 2

Verdict: ACCEPTED

input
7

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Error:
0.001966

Test 6

Group: 1, 2

Verdict: ACCEPTED

input
8

correct output
2 3 1 2 3 3 2 1 

user output
2 3 1 2 3 3 2 1 

Error:
0.001943

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 

Error:
0.001917

Test 8

Group: 1, 2

Verdict: ACCEPTED

input
10

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Error:
0.001709

Test 9

Group: 2

Verdict:

input
42

correct output
1 3 2 2 1 3 1 2 3 3 2 1 1 2 3 ...

user output
(empty)

Error:
0.001855

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

Error:
0.001947

Test 11

Group: 2

Verdict:

input
96

correct output
1 3 2 2 1 3 1 2 3 3 2 1 1 2 3 ...

user output
(empty)

Error:
0.001733

Test 12

Group: 2

Verdict: ACCEPTED

input
97

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Error:
0.001817

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

Error:
0.00198

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

Error:
0.001937

Test 15

Group: 2

Verdict: ACCEPTED

input
100

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Error:
0.001918