git reimport
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
19 A - Mystical Mosaic
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
3
|
||||
0
|
||||
49 5 8
|
||||
.#.#..#.
|
||||
.....#..
|
||||
.#.#..#.
|
||||
#.#....#
|
||||
.....#..
|
||||
|
||||
4 Yes
|
||||
|
||||
1
|
||||
1
|
||||
34 5 5
|
||||
..#..
|
||||
..#..
|
||||
#####
|
||||
..#..
|
||||
..#..
|
||||
|
||||
3 No
|
||||
|
||||
1
|
||||
2
|
||||
54 5 9
|
||||
........#
|
||||
#........
|
||||
..##.#...
|
||||
.......#.
|
||||
....#.#.#
|
||||
|
||||
3 No
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskA
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,42 @@
|
||||
21 B - Three-level Laser
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
3
|
||||
0
|
||||
12 4 4
|
||||
1 3 5 7
|
||||
|
||||
4 0.5
|
||||
|
||||
1
|
||||
1
|
||||
35 10 8
|
||||
10 13 15 16 17 19 20 22 24 25
|
||||
|
||||
6 0.875
|
||||
|
||||
1
|
||||
2
|
||||
11 3 1
|
||||
2 5 10
|
||||
|
||||
3 -1
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskB
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,100 @@
|
||||
19 C - Riverside Curio
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
14
|
||||
0
|
||||
14 6
|
||||
0 1 0 3 0 2
|
||||
|
||||
2 6
|
||||
|
||||
1
|
||||
1
|
||||
12 5
|
||||
0 1 2 1 2
|
||||
|
||||
2 1
|
||||
|
||||
1
|
||||
2
|
||||
12 5
|
||||
0 1 1 2 2
|
||||
|
||||
2 0
|
||||
|
||||
1
|
||||
3
|
||||
13 6
|
||||
0 1 2 3 4 0
|
||||
1 4
|
||||
1
|
||||
4
|
||||
11 5
|
||||
0 0 0 0 4
|
||||
1 6
|
||||
1
|
||||
5
|
||||
11 5
|
||||
0 0 0 0 0
|
||||
1 0
|
||||
1
|
||||
6
|
||||
11 5
|
||||
0 1 0 0 0
|
||||
1 3
|
||||
1
|
||||
7
|
||||
17 8
|
||||
0 1 0 0 0 0 0 5
|
||||
2 11
|
||||
1
|
||||
8
|
||||
3 1
|
||||
0
|
||||
1 0
|
||||
1
|
||||
9
|
||||
7 3
|
||||
0 1 2
|
||||
1 0
|
||||
1
|
||||
10
|
||||
46 11
|
||||
0 0 0 0 4 0 0 0 0 0 6
|
||||
0 1 2 3 4 4 4 4 4 5 6
|
||||
2 27
|
||||
1
|
||||
11
|
||||
37 9
|
||||
0 1 2 3 4 3 2 1 0
|
||||
0 1 2 3 4 4 4 4 4
|
||||
2 10
|
||||
1
|
||||
12
|
||||
54 13
|
||||
0 0 1 0 0 1 0 0 1 6 0 0 0
|
||||
0 0 1 1 1 2 3 4 5 6 6 6 6
|
||||
2 32
|
||||
1
|
||||
13
|
||||
22 10
|
||||
0 1 2 3 1 1 1 1 1 1
|
||||
2 12
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskC
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,80 @@
|
||||
15 D - Contact ATC
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
7
|
||||
0
|
||||
29 5 1
|
||||
-3 2
|
||||
-3 3
|
||||
-1 2
|
||||
1 -3
|
||||
3 -5
|
||||
|
||||
2 3
|
||||
|
||||
1
|
||||
1
|
||||
34 6 1
|
||||
-3 2
|
||||
-2 2
|
||||
-1 2
|
||||
1 -2
|
||||
2 -2
|
||||
3 -2
|
||||
|
||||
2 9
|
||||
|
||||
1
|
||||
2
|
||||
23 4 0
|
||||
-1 1
|
||||
-2 2
|
||||
3 -3
|
||||
4 -4
|
||||
1 4
|
||||
0
|
||||
3
|
||||
23 4 0
|
||||
-1 1
|
||||
-2 2
|
||||
3 -3
|
||||
4 -5
|
||||
1 2
|
||||
0
|
||||
4
|
||||
25 4 100
|
||||
-1 1
|
||||
-2 2
|
||||
3 -3
|
||||
4 -5
|
||||
1 4
|
||||
0
|
||||
5
|
||||
13 2 0
|
||||
-1 1
|
||||
-2 2
|
||||
1 1
|
||||
1
|
||||
6
|
||||
15 2 2
|
||||
6 -4
|
||||
24 -10
|
||||
1 1
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskD
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,37 @@
|
||||
12 E - Wardrobe
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
2
|
||||
0
|
||||
26 5 3 6
|
||||
3 2 5 1 2
|
||||
1 1 0 1 0
|
||||
|
||||
2 2
|
||||
|
||||
1
|
||||
1
|
||||
14 2 2 5
|
||||
3 6
|
||||
1 1
|
||||
|
||||
2 1
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskE
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,71 @@
|
||||
29 F - Minimal Subset Difference
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
2
|
||||
0
|
||||
83 10
|
||||
1 100 0
|
||||
1 100 1
|
||||
1 100 2
|
||||
1 100 3
|
||||
1 100 4
|
||||
1 100 5
|
||||
1 100 6
|
||||
1 100 7
|
||||
1 100 8
|
||||
1 100 9
|
||||
|
||||
30 9
|
||||
28
|
||||
44
|
||||
58
|
||||
70
|
||||
80
|
||||
88
|
||||
94
|
||||
98
|
||||
100
|
||||
|
||||
1
|
||||
1
|
||||
93 10
|
||||
1 1000 0
|
||||
1 1000 1
|
||||
1 1000 2
|
||||
1 1000 3
|
||||
1 1000 4
|
||||
1 1000 5
|
||||
1 1000 6
|
||||
1 1000 7
|
||||
1 1000 8
|
||||
1 1000 9
|
||||
|
||||
41 135
|
||||
380
|
||||
573
|
||||
721
|
||||
830
|
||||
906
|
||||
955
|
||||
983
|
||||
996
|
||||
1000
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskF
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2018.03.24
|
||||
21 VK Cup 2018 - Round 2
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,61 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskA extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int m = in.nextInt();
|
||||
|
||||
boolean[][] a = new boolean[n][m];
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
String s = in.nextString();
|
||||
for(int j = 0; j < m; j++) {
|
||||
a[i][j] = s.charAt(j) == '#';
|
||||
}
|
||||
}
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
Set<Integer> atBaseLine = new HashSet<>();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (a[i][j]) {
|
||||
atBaseLine.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int ii = i + 1; ii < n; ii++) {
|
||||
Set<Integer> atNextLine = new HashSet<>();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
if (a[ii][j]) {
|
||||
atNextLine.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
Set<Integer> intersection = new HashSet<>(atBaseLine);
|
||||
intersection.retainAll(atNextLine);
|
||||
|
||||
if (!intersection.isEmpty() && !atBaseLine.equals(atNextLine)) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out.println(ok ? "Yes" : "No");
|
||||
}}
|
@@ -0,0 +1,21 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskB extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
int u = in.nextInt();
|
||||
|
||||
|
||||
}
|
||||
}
|
112
archive/2018.03/2018.03.24 - VK Cup 2018 - Round 2/TaskC.java
Normal file
112
archive/2018.03/2018.03.24 - VK Cup 2018 - Round 2/TaskC.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskC extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
class Pos implements Comparable<Pos> {
|
||||
long height;
|
||||
int pos;
|
||||
|
||||
public Pos(long height, int pos) {
|
||||
this.height = height;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Pos o) {
|
||||
int t = Long.compare(height, o.height);
|
||||
if (t != 0) {
|
||||
return t;
|
||||
}
|
||||
return -Integer.compare(pos, o.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Pos pos1 = (Pos) o;
|
||||
return height == pos1.height &&
|
||||
pos == pos1.pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return Objects.hash(height, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
|
||||
long[] above = in.nextLongArray(n);
|
||||
|
||||
long[] total = new long[n];
|
||||
|
||||
TreeSet<Pos> poses = new TreeSet<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
poses.add(new Pos(above[i], i));
|
||||
}
|
||||
// poses.add(new Pos(-1, -1));
|
||||
|
||||
Pos highest = poses.pollLast();
|
||||
total[highest.pos] = highest.height;
|
||||
|
||||
// while (!poses.isEmpty()) {
|
||||
// Pos next = poses.pollLast();
|
||||
// if (next.pos > highest.pos) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// long h = highest.height;
|
||||
//
|
||||
// for (int i = highest.pos; i >= Math.max(next.pos, 0); i--) {
|
||||
// total[i] = h;
|
||||
// if (h > next.height) {
|
||||
// h--;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// highest = next;
|
||||
// }
|
||||
|
||||
long h = highest.height;
|
||||
for (int pos = highest.pos; pos < n; pos++) {
|
||||
poses.remove(new Pos(above[pos], pos));
|
||||
total[pos] = h;
|
||||
}
|
||||
|
||||
for (int pos = highest.pos - 1; pos >= 0; pos--) {
|
||||
if (h > poses.last().height) {
|
||||
h--;
|
||||
}
|
||||
total[pos] = h;
|
||||
poses.remove(new Pos(above[pos], pos));
|
||||
}
|
||||
|
||||
h = 0;
|
||||
long sum = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
// h = Math.max(h, total[i]);
|
||||
sum += total[i] - above[i];
|
||||
}
|
||||
|
||||
out.println(sum);
|
||||
}
|
||||
}
|
185
archive/2018.03/2018.03.24 - VK Cup 2018 - Round 2/TaskD.java
Normal file
185
archive/2018.03/2018.03.24 - VK Cup 2018 - Round 2/TaskD.java
Normal file
@@ -0,0 +1,185 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskD extends SimpleSavingChelperSolution {
|
||||
|
||||
private Comparator<Interval> sortLeft = new Comparator<Interval>() {
|
||||
@Override
|
||||
public int compare(Interval o1, Interval o2) {
|
||||
int t = o1.l.compareTo(o2.l);
|
||||
if (t != 0) {
|
||||
return t;
|
||||
}
|
||||
|
||||
return Integer.compare(o1.i, o2.i);
|
||||
}
|
||||
};
|
||||
private Comparator<Interval> sortRight = new Comparator<Interval>() {
|
||||
@Override
|
||||
public int compare(Interval o1, Interval o2) {
|
||||
int t = o1.r.compareTo(o2.r);
|
||||
if (t != 0) {
|
||||
return t;
|
||||
}
|
||||
|
||||
return Integer.compare(o1.i, o2.i);
|
||||
}
|
||||
};
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
class Ratio implements Comparable<Ratio> {
|
||||
long num, denom;
|
||||
|
||||
public Ratio(long num, long denom) {
|
||||
this.num = num;
|
||||
this.denom = denom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Ratio o) {
|
||||
long a = num * o.denom;
|
||||
long b = o.num * denom;
|
||||
|
||||
return Long.compare(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
class Interval {
|
||||
Ratio l, r;
|
||||
|
||||
int i;
|
||||
|
||||
int order = -1;
|
||||
|
||||
public Interval(Ratio l, Ratio r, int i) {
|
||||
this.l = l;
|
||||
this.r = r;
|
||||
this.i = i;
|
||||
}
|
||||
}
|
||||
|
||||
long countOneSide(List<Interval> intervals) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
|
||||
int maxW = in.nextInt();
|
||||
|
||||
List<Interval> left = new ArrayList<>();
|
||||
List<Interval> right = new ArrayList<>();
|
||||
|
||||
long res = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
int x = in.nextInt();
|
||||
int v = in.nextInt();
|
||||
|
||||
// double minTime = Math.abs(x) / (Math.abs(v) + maxW);
|
||||
// double maxTime = Math.abs(x) / (Math.abs(v) - maxW);
|
||||
|
||||
Ratio minTime = new Ratio(Math.abs(x), Math.abs(v) + maxW);
|
||||
Ratio maxTime = new Ratio(Math.abs(x), Math.abs(v) - maxW);
|
||||
|
||||
if (x < 0) {
|
||||
left.add(new Interval(minTime, maxTime, i));
|
||||
} else {
|
||||
right.add(new Interval(minTime, maxTime, i));
|
||||
}
|
||||
}
|
||||
|
||||
Comparator<Interval> check = new Comparator<Interval>() {
|
||||
@Override
|
||||
public int compare(Interval o1, Interval o2) {
|
||||
int t = o1.l.compareTo(o2.l);
|
||||
if (t != 0) {
|
||||
return t;
|
||||
}
|
||||
t = o1.r.compareTo(o2.r);
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
};
|
||||
TreeMap<Interval, Integer> s = new TreeMap<>(check);
|
||||
for (Interval interval : left) {
|
||||
s.putIfAbsent(interval, 0);
|
||||
|
||||
s.put(interval, s.get(interval) + 1);
|
||||
}
|
||||
for (Integer integer : s.values()) {
|
||||
res += (integer - 1L) * (integer - 0L) / 2;
|
||||
}
|
||||
|
||||
s = new TreeMap<>(check);
|
||||
for (Interval interval : right) {
|
||||
s.putIfAbsent(interval, 0);
|
||||
|
||||
s.put(interval, s.get(interval) + 1);
|
||||
}
|
||||
for (Integer integer : s.values()) {
|
||||
res += (integer - 1L) * (integer - 0L) / 2;
|
||||
}
|
||||
|
||||
|
||||
TreeSet<Interval> rightSortLeft = new TreeSet<>(sortLeft);
|
||||
for (Interval interval : right) {
|
||||
rightSortLeft.add(new Interval(interval.l, interval.r, interval.i));
|
||||
}
|
||||
|
||||
int howManyLeft = right.size();
|
||||
for (Interval interval : rightSortLeft) {
|
||||
interval.order = howManyLeft;
|
||||
howManyLeft--;
|
||||
}
|
||||
|
||||
TreeSet<Interval> rightSortRight = new TreeSet<>(sortRight);
|
||||
for (Interval interval : right) {
|
||||
rightSortRight.add(new Interval(interval.l, interval.r, interval.i));
|
||||
}
|
||||
|
||||
howManyLeft = 0;
|
||||
for (Interval interval : rightSortRight) {
|
||||
howManyLeft++;
|
||||
interval.order = howManyLeft;
|
||||
}
|
||||
|
||||
for (Interval interval : left) {
|
||||
Interval higher = rightSortLeft.higher(new Interval(interval.r, interval.r, n));
|
||||
|
||||
int toRight = 0;
|
||||
if (higher != null) {
|
||||
toRight = higher.order;
|
||||
}
|
||||
|
||||
|
||||
Interval lower = rightSortRight.lower(new Interval(interval.l, interval.l, -1));
|
||||
|
||||
int toLeft = 0;
|
||||
if (lower != null) {
|
||||
toLeft = lower.order;
|
||||
}
|
||||
|
||||
res += right.size() - toLeft - toRight;
|
||||
}
|
||||
|
||||
out.println(res);
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskE extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskF extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user