# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172260 | ijxjdjd | Arranging Shoes (IOI19_shoes) | Java | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
public class shoes {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
shoe solver = new shoe();
solver.solve(1, in, out);
out.close();
}
static class shoe {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int N = in.nextInt();
ArrayDeque<Integer>[] left = new ArrayDeque[N];
ArrayDeque<Integer>[] right = new ArrayDeque[N];
for (int i = 0; i < N; i++) {
left[i] = new ArrayDeque<>();
right[i] = new ArrayDeque<>();
}
FenwickTree unset = new FenwickTree(2 * N);
for (int i = 0; i < 2 * N; i++) {
int a = in.nextInt();
if (a < 0) {
left[(-a) - 1].add(i);
} else {
right[a - 1].add(i);
}
unset.add(i, 1);
}