Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link ×

ggok's blog

By ggok, history, 4 years ago, In English,

Hi, I recently came across this question and i have no idea how to approach it.

You are given a number N (3 ≤ N ≤ 100000) and you should create a permutation of the first N numbers.

The permutation should not have an arithmetic subsequence with three or more terms in it.

for example

5             4 2 3 1 5
3             3 1 2
  • Vote: I like it
  • 0
  • Vote: I do not like it

4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Take a look at this problem (and its solution).