4 public class central_md
{
5 private static Scanner in
;
6 private static PrintWriter out
;
12 private int ask(int a
, int b
, int c
) {
13 out
.println((a
+ 1) + " " + (b
+ 1) + " " + (c
+ 1));
20 for (int i
= 0; i
< n
; i
++) {
21 out
.print(" " + value
[i
]);
43 private void solveLarge() {
45 List
<Integer
> small
= new ArrayList
<Integer
>();
46 List
<Integer
> large
= new ArrayList
<Integer
>();
47 for (int i
= 0; i
< n
; i
++) {
48 if (i
== a
|| i
== b
) {
51 if (value
[i
] == low
) {
53 } else if (value
[i
] == high
) {
57 value
[a
] = ask(small
.get(0), large
.get(0), a
);
58 value
[b
] = value
[a
] ^ low ^ high
;
60 process(large
, n
- 1, n
);
63 private void findAB() {
64 for (a
= 0; a
< 10 && a
+ 1 < n
; a
+= 2) {
68 for (a
= 0; a
< 6; a
++) {
69 for (b
= a
+ 1; b
< 6; b
++) {
75 private boolean tryAB() {
80 for (int i
= 0; i
< n
; i
++) {
81 if (i
== a
|| i
== b
) {
84 value
[i
] = ask(a
, b
, i
);
88 } else if (value
[i
] == low
) {
91 if (value
[i
] > high
) {
94 } else if (value
[i
] == high
) {
98 return low
!= high
&& lowCount
> 1 && highCount
> 1;
101 private void process(List
<Integer
> cells
, int rest1
, int rest2
) {
102 while (cells
.size() >= 3) {
103 int x
= cells
.get(cells
.size() - 3);
104 int y
= cells
.get(cells
.size() - 2);
105 int z
= cells
.get(cells
.size() - 1);
106 int xy
= ask(x
, y
, a
);
107 int xz
= ask(x
, z
, a
);
108 int yz
= ask(y
, z
, a
);
109 int cell
, val
, index
;
113 index
= cells
.size() - 3;
114 } else if (xy
== yz
) {
117 index
= cells
.size() - 2;
121 index
= cells
.size() - 1;
126 value
[cells
.get(0)] = rest1
;
127 value
[cells
.get(1)] = rest2
;
130 private void solveSmall() {
131 for (int i
= 0; i
< n
; i
++) {
132 for (int j
= i
+ 1; j
< n
; j
++) {
133 for (int k
= j
+ 1; k
< n
; k
++) {
134 int v
= ask(i
, j
, k
);
141 List
<Integer
> list
= new ArrayList
<Integer
>();
142 for (int i
= 0; i
< n
; i
++) {
143 value
[i
] = n
* value
[i
] + i
;
146 Collections
.sort(list
);
147 for (int i
= 0; i
< n
; i
++) {
148 value
[i
] = list
.indexOf(value
[i
]) + 1;
152 public static void main(String
[] args
) {
153 Locale
.setDefault(Locale
.US
);
154 in
= new Scanner(System
.in
);
155 out
= new PrintWriter(System
.out
);
156 new central_md().run();