-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q7_1092.java
70 lines (51 loc) · 1.44 KB
/
Q7_1092.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Name: Amaresh Swain
* Reg No: 2341019646
* PS LINK: https://cses.fi/problemset/task/1092
*/
import java.io.*;
public class Q7_1092
{
public static void main(String[] args)throws IOException
{
int i,n;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
n=Integer.parseInt(br.readLine());
StringBuilder sb=new StringBuilder();
if(n%4==0)
{
sb.append("YES\n");
sb.append(n/2).append("\n");
for(i=1;i<=n;i+=4)
sb.append(i).append(" ");
for(i=4;i<=n;i+=4)
sb.append(i).append(" ");
sb.append("\n");
sb.append(n/2).append("\n");
for(i=2;i<=n;i+=4)
sb.append(i).append(" ");
for(i=3;i<=n;i+=4)
sb.append(i).append(" ");
}
else if (n%4==3)
{
sb.append("YES\n");
sb.append(n/2+1).append("\n");
for(i=1;i<=n;i+=4)
sb.append(i).append(" ");
for(i=2;i<=n;i+=4)
sb.append(i).append(" ");
sb.append("\n");
sb.append(n/2).append("\n");
for(i=4;i<=n;i+=4)
sb.append(i).append(" ");
for(i=3;i<=n;i+=4)
sb.append(i).append(" ");
}
else
{
sb.append("NO\n");
}
System.out.println(sb);
}
}