git reimport
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
16 A - Jumping Ball
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
3
|
||||
0
|
||||
7 4
|
||||
<<><
|
||||
|
||||
1 2
|
||||
1
|
||||
1
|
||||
8 5
|
||||
>>>>>
|
||||
|
||||
1 5
|
||||
1
|
||||
2
|
||||
7 4
|
||||
>><<
|
||||
|
||||
1 0
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskA
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,45 @@
|
||||
21 B - Food on the Plane
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
4
|
||||
0
|
||||
3 1f
|
||||
|
||||
2 1
|
||||
|
||||
1
|
||||
1
|
||||
3 2d
|
||||
|
||||
3 10
|
||||
|
||||
1
|
||||
2
|
||||
3 4a
|
||||
|
||||
3 11
|
||||
|
||||
1
|
||||
3
|
||||
3 5e
|
||||
|
||||
3 18
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskB
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,34 @@
|
||||
15 C - Hidden Word
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
2
|
||||
0
|
||||
28 ABCDEFGHIJKLMNOPQRSGTUVWXYZ
|
||||
|
||||
28 YXWVUTGHIJKLM
|
||||
ZABCDEFSRQPON
|
||||
|
||||
1
|
||||
1
|
||||
28 BUVTYZFQSNRIWOXXGJLKACPEMDH
|
||||
|
||||
11 Impossible
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskC
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,67 @@
|
||||
20 D - Contest Balloons
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
4
|
||||
0
|
||||
57 8
|
||||
20 1000
|
||||
32 37
|
||||
40 1000
|
||||
45 50
|
||||
16 16
|
||||
16 16
|
||||
14 1000
|
||||
2 1000
|
||||
|
||||
2 3
|
||||
|
||||
1
|
||||
1
|
||||
30 7
|
||||
4 4
|
||||
4 4
|
||||
4 4
|
||||
4 4
|
||||
4 4
|
||||
4 4
|
||||
5 5
|
||||
|
||||
2 2
|
||||
|
||||
1
|
||||
2
|
||||
145 7
|
||||
14000000003 1000000000000000000
|
||||
81000000000 88000000000
|
||||
5000000000 7000000000
|
||||
15000000000 39000000000
|
||||
46000000000 51000000000
|
||||
0 1000000000
|
||||
0 0
|
||||
|
||||
2 2
|
||||
|
||||
1
|
||||
3
|
||||
11 2
|
||||
0 0
|
||||
10 10
|
||||
-1
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskD
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,46 @@
|
||||
18 E - Too Much Money
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
2
|
||||
0
|
||||
11 12
|
||||
3
|
||||
5
|
||||
3
|
||||
4
|
||||
|
||||
2 5
|
||||
|
||||
1
|
||||
1
|
||||
25 50
|
||||
8
|
||||
1
|
||||
2
|
||||
4
|
||||
8
|
||||
16
|
||||
37
|
||||
37
|
||||
37
|
||||
|
||||
14 Greed is good
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskE
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,44 @@
|
||||
17 F - Family Photos
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
3
|
||||
0
|
||||
20 2
|
||||
12 3 4 7
|
||||
1 15 9 1
|
||||
|
||||
2 1
|
||||
|
||||
1
|
||||
1
|
||||
20 2
|
||||
5 4 8 8
|
||||
4 12 14 0
|
||||
|
||||
2 4
|
||||
|
||||
1
|
||||
2
|
||||
12 1
|
||||
0 10 0 10
|
||||
|
||||
4 -10
|
||||
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskF
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
@@ -0,0 +1,47 @@
|
||||
22 G - Messages on a Tree
|
||||
6 SINGLE
|
||||
8 STANDARD
|
||||
-1
|
||||
8 STANDARD
|
||||
-1
|
||||
3
|
||||
0
|
||||
29 6 3
|
||||
0 1 2 3 2 5
|
||||
4 6
|
||||
6 9
|
||||
5 11
|
||||
|
||||
9 14 13 11
|
||||
1
|
||||
1
|
||||
18 3 2
|
||||
0 1 1
|
||||
2 1
|
||||
3 1
|
||||
|
||||
4 5 3
|
||||
1
|
||||
2
|
||||
32 8 3
|
||||
0 1 1 2 3 3 4 5
|
||||
6 1
|
||||
8 2
|
||||
4 5
|
||||
|
||||
7 7 6 11
|
||||
1
|
||||
11 src/chelper
|
||||
8 -Xmx256M
|
||||
4 Main
|
||||
13 chelper.TaskG
|
||||
39 net.egork.chelper.checkers.TokenChecker
|
||||
0
|
||||
0
|
||||
10 2016.10.22
|
||||
15 Canada Cup 2016
|
||||
1
|
||||
14 io.InputReader
|
||||
15 io.OutputWriter
|
||||
0
|
||||
0
|
31
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskA.java
Normal file
31
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskA.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskA {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
int n = in.nextInt();
|
||||
String s = in.nextString();
|
||||
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (s.charAt(i) == '<') {
|
||||
c++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (s.charAt(n - i - 1) == '>') {
|
||||
c++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out.println(c);
|
||||
}
|
||||
}
|
36
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskB.java
Normal file
36
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskB.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package chelper;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskB {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
String s = in.nextString();
|
||||
|
||||
long n = Long.parseLong(s.substring(0, s.length() - 1)) - 1;
|
||||
int p = s.charAt(s.length() - 1);
|
||||
|
||||
BigInteger ans = BigInteger.valueOf(n / 4).multiply(BigInteger.valueOf(16));
|
||||
|
||||
long c = 0;
|
||||
|
||||
switch (p) {
|
||||
case 'a': c += 4; break;
|
||||
case 'b': c += 5; break;
|
||||
case 'c': c += 6; break;
|
||||
case 'd': c += 3; break;
|
||||
case 'e': c += 2; break;
|
||||
case 'f': c += 1; break;
|
||||
}
|
||||
|
||||
if ((n % 4) % 2 == 1) {
|
||||
c += 7;
|
||||
}
|
||||
|
||||
ans = ans.add(BigInteger.valueOf(c));
|
||||
|
||||
out.println(ans);
|
||||
}
|
||||
}
|
92
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskC.java
Normal file
92
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskC.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskC {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
char[] ch = in.nextString().toCharArray();
|
||||
int[] a = new int[26];
|
||||
|
||||
char dup = 0;
|
||||
int[] fpos = new int[26];
|
||||
Arrays.fill(fpos, -1);
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
char c = ch[i];
|
||||
if (fpos[c - 'A'] == -1) {
|
||||
fpos[c - 'A'] = i;
|
||||
}
|
||||
a[c - 'A']++;
|
||||
if (a[c - 'A'] >= 2) {
|
||||
if (dup == 0) {
|
||||
dup = c;
|
||||
} else {
|
||||
out.println("Impossible");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<Character> pre = new ArrayList<>();
|
||||
List<Character> mid = new ArrayList<>();
|
||||
List<Character> post = new ArrayList<>();
|
||||
|
||||
int st = 0;
|
||||
|
||||
for (char c : ch) {
|
||||
if (c == dup) {
|
||||
st++;
|
||||
} else {
|
||||
if (st == 0) {
|
||||
pre.add(c);
|
||||
}
|
||||
if (st == 1) {
|
||||
mid.add(c);
|
||||
}
|
||||
if (st == 2) {
|
||||
post.add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mid.size() == 0) {
|
||||
out.println("Impossible");
|
||||
return;
|
||||
}
|
||||
|
||||
int pos = 13 - mid.size() / 2 - 1;
|
||||
|
||||
char[] res = new char[26];
|
||||
|
||||
res[pos] = dup;
|
||||
|
||||
int strpos = fpos[dup - 'A'];
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
char c = ch[strpos];
|
||||
strpos = (strpos + 1) % 27;
|
||||
if (c == dup) {
|
||||
continue;
|
||||
}
|
||||
pos = (pos + 1) % 26;
|
||||
res[pos] = c;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 13; i++) {
|
||||
out.print(res[i]);
|
||||
}
|
||||
out.println();
|
||||
|
||||
for (int i = 0; i < 13; i++) {
|
||||
out.print(res[25 - i]);
|
||||
}
|
||||
out.println();
|
||||
}
|
||||
}
|
136
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskD.java
Normal file
136
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskD.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskD {
|
||||
class Team implements Comparable<Team> {
|
||||
public final long score;
|
||||
public final long weight;
|
||||
public final long leeway;
|
||||
private final int index;
|
||||
|
||||
public Team(int index, long score, long weight) {
|
||||
this.index = index;
|
||||
this.score = score;
|
||||
this.weight = weight;
|
||||
leeway = weight - score + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Team o) {
|
||||
return Long.compare(leeway, o.leeway);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Team team = (Team) o;
|
||||
|
||||
if (score != team.score) return false;
|
||||
if (weight != team.weight) return false;
|
||||
if (leeway != team.leeway) return false;
|
||||
return index == team.index;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (score ^ score >>> 32);
|
||||
result = 31 * result + (int) (weight ^ weight >>> 32);
|
||||
result = 31 * result + (int) (leeway ^ leeway >>> 32);
|
||||
result = 31 * result + index;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
int n = in.nextInt() - 1;
|
||||
long ourScore = in.nextLong();
|
||||
long ourWeight = in.nextLong();
|
||||
List<Team> teams = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
Team team = new Team(i, in.nextLong(), in.nextLong());
|
||||
teams.add(team);
|
||||
}
|
||||
|
||||
Collections.sort(teams);
|
||||
|
||||
List<Team> left = new ArrayList<>();
|
||||
List<Team> right = new ArrayList<>();
|
||||
|
||||
for (Team team : teams) {
|
||||
if (team.score > ourScore) {
|
||||
left.add(team);
|
||||
} else {
|
||||
right.add(team);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(right, new Comparator<Team>() {
|
||||
@Override
|
||||
public int compare(Team o1, Team o2) {
|
||||
return -Long.compare(o1.score, o2.score);
|
||||
}
|
||||
});
|
||||
|
||||
long ans = left.size() + 1;
|
||||
|
||||
SortedMap<Long, Long> leftMap = new TreeMap<>();
|
||||
|
||||
for (Team team : left) {
|
||||
if (!leftMap.containsKey(team.leeway)) {
|
||||
leftMap.put(team.leeway, 0L);
|
||||
}
|
||||
leftMap.put(team.leeway, leftMap.get(team.leeway) + 1);
|
||||
}
|
||||
|
||||
int rightPos = 0;
|
||||
int ourPlace = left.size() + 1;
|
||||
|
||||
while (!leftMap.isEmpty()) {
|
||||
long minLeeway = leftMap.firstKey();
|
||||
ourScore -= minLeeway;
|
||||
if (ourScore < 0) {
|
||||
break;
|
||||
}
|
||||
long minVal = leftMap.get(minLeeway) - 1;
|
||||
if (minVal == 0) {
|
||||
leftMap.remove(minLeeway);
|
||||
} else {
|
||||
leftMap.put(minLeeway, minVal);
|
||||
}
|
||||
ourPlace--;
|
||||
|
||||
while (rightPos < right.size()) {
|
||||
Team team = right.get(rightPos);
|
||||
if (team.score > ourScore) {
|
||||
if (!leftMap.containsKey(team.leeway)) {
|
||||
leftMap.put(team.leeway, 0L);
|
||||
}
|
||||
leftMap.put(team.leeway, leftMap.get(team.leeway) + 1);
|
||||
rightPos++;
|
||||
ourPlace++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ans = Math.min(ans, ourPlace);
|
||||
}
|
||||
|
||||
out.println(ans);
|
||||
}
|
||||
}
|
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskE.java
Normal file
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskE.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskE {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
}
|
||||
}
|
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskF.java
Normal file
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskF.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskF {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
}
|
||||
}
|
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskG.java
Normal file
9
archive/2016.10/2016.10.22 - Canada Cup 2016/TaskG.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskG {
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user