Browse Source

Initial commit

main
Mattéo Delabre 2 months ago
commit
58756b70e8
Signed by: matteo <spam@delab.re> GPG Key ID: AE3FBD02DC583ABB
100 changed files with 807662 additions and 0 deletions
  1. +11
    -0
      battledev/2020-1/A/A.py
  2. +7
    -0
      battledev/2020-1/A/input1.txt
  3. +28
    -0
      battledev/2020-1/A/input2.txt
  4. +28
    -0
      battledev/2020-1/A/input3.txt
  5. +2800
    -0
      battledev/2020-1/A/input4.txt
  6. +1
    -0
      battledev/2020-1/A/output1.txt
  7. +1
    -0
      battledev/2020-1/A/output2.txt
  8. +1
    -0
      battledev/2020-1/A/output3.txt
  9. +1
    -0
      battledev/2020-1/A/output4.txt
  10. +22
    -0
      battledev/2020-1/B/B.py
  11. +11
    -0
      battledev/2020-1/B/input1.txt
  12. +76
    -0
      battledev/2020-1/B/input2.txt
  13. +833
    -0
      battledev/2020-1/B/input3.txt
  14. +755
    -0
      battledev/2020-1/B/input4.txt
  15. +1
    -0
      battledev/2020-1/B/output1.txt
  16. +1
    -0
      battledev/2020-1/B/output2.txt
  17. +1
    -0
      battledev/2020-1/B/output3.txt
  18. +1
    -0
      battledev/2020-1/B/output4.txt
  19. +33
    -0
      battledev/2020-1/C/C.py
  20. +6
    -0
      battledev/2020-1/C/input1.txt
  21. +6
    -0
      battledev/2020-1/C/input2.txt
  22. +6
    -0
      battledev/2020-1/C/input3.txt
  23. +17
    -0
      battledev/2020-1/C/input4.txt
  24. +1001
    -0
      battledev/2020-1/C/input5.txt
  25. +1
    -0
      battledev/2020-1/C/output1.txt
  26. +1
    -0
      battledev/2020-1/C/output2.txt
  27. +1
    -0
      battledev/2020-1/C/output3.txt
  28. +1
    -0
      battledev/2020-1/C/output4.txt
  29. +1
    -0
      battledev/2020-1/C/output5.txt
  30. +114
    -0
      battledev/2020-1/D/D.py
  31. +3
    -0
      battledev/2020-1/D/input1.txt
  32. +3
    -0
      battledev/2020-1/D/input2.txt
  33. +3
    -0
      battledev/2020-1/D/input3.txt
  34. +3
    -0
      battledev/2020-1/D/input4.txt
  35. +3
    -0
      battledev/2020-1/D/input5.txt
  36. +3
    -0
      battledev/2020-1/D/input6.txt
  37. +3
    -0
      battledev/2020-1/D/input7.txt
  38. +1
    -0
      battledev/2020-1/D/output1.txt
  39. +1
    -0
      battledev/2020-1/D/output2.txt
  40. +1
    -0
      battledev/2020-1/D/output3.txt
  41. +1
    -0
      battledev/2020-1/D/output4.txt
  42. +1
    -0
      battledev/2020-1/D/output5.txt
  43. +1
    -0
      battledev/2020-1/D/output6.txt
  44. +1
    -0
      battledev/2020-1/D/output7.txt
  45. +31
    -0
      battledev/2020-1/E/E.py
  46. +2
    -0
      battledev/2020-1/E/input1.txt
  47. +2
    -0
      battledev/2020-1/E/input2.txt
  48. +2
    -0
      battledev/2020-1/E/input3.txt
  49. +2
    -0
      battledev/2020-1/E/input4.txt
  50. +1
    -0
      battledev/2020-1/E/output1.txt
  51. +1
    -0
      battledev/2020-1/E/output2.txt
  52. +1
    -0
      battledev/2020-1/E/output3.txt
  53. +1
    -0
      battledev/2020-1/E/output4.txt
  54. +8
    -0
      battledev/2020-2/a-in
  55. +12
    -0
      battledev/2020-2/a.py
  56. +6
    -0
      battledev/2020-2/b-in
  57. +6
    -0
      battledev/2020-2/b-in2
  58. +15
    -0
      battledev/2020-2/b.py
  59. +5
    -0
      battledev/2020-2/c-in
  60. +22
    -0
      battledev/2020-2/c.py
  61. +6
    -0
      battledev/2020-2/d-in
  62. +19
    -0
      battledev/2020-2/d.py
  63. +29
    -0
      battledev/2020-2/e.py
  64. +42
    -0
      battledev/2020-2/e2.py
  65. +9
    -0
      codeforces/codeforces-615/A/A-in1
  66. +13
    -0
      codeforces/codeforces-615/A/A.py
  67. +12
    -0
      codeforces/codeforces-615/B/B-in1
  68. +29
    -0
      codeforces/codeforces-615/B/B.py
  69. +18
    -0
      codeforces/codeforces-615/C/C-guil.py
  70. +2
    -0
      codeforces/codeforces-615/C/C-in1
  71. +17
    -0
      codeforces/codeforces-615/C/C-new.py
  72. +19
    -0
      codeforces/codeforces-615/C/C.py
  73. +101
    -0
      codeforces/codeforces-615/F/F-dp.py
  74. +8
    -0
      codeforces/codeforces-615/F/F-in0
  75. +9
    -0
      codeforces/codeforces-615/F/F-in1
  76. +11
    -0
      codeforces/codeforces-615/F/F-in2
  77. +10
    -0
      codeforces/codeforces-615/F/F-in3
  78. +200000
    -0
      codeforces/codeforces-615/F/F-in4
  79. +200000
    -0
      codeforces/codeforces-615/F/F-in5
  80. +200000
    -0
      codeforces/codeforces-615/F/F-in6
  81. +200000
    -0
      codeforces/codeforces-615/F/F-in7
  82. +104
    -0
      codeforces/codeforces-615/F/F-new.py
  83. +69
    -0
      codeforces/codeforces-615/F/F.py
  84. +7
    -0
      codeforces/codeforces-615/F/genpath.py
  85. +7
    -0
      codeforces/codeforces-615/F/genstar.py
  86. +41
    -0
      codeforces/codeforces-615/F/gentree.py
  87. +8
    -0
      codeforces/codeforces-622/A/A-in1
  88. +25
    -0
      codeforces/codeforces-622/A/A.py
  89. +2
    -0
      codeforces/codeforces-622/B/B-in1
  90. +2
    -0
      codeforces/codeforces-622/B/B-in2
  91. +2
    -0
      codeforces/codeforces-622/B/B-in3
  92. +2
    -0
      codeforces/codeforces-622/B/B-in4
  93. +1001
    -0
      codeforces/codeforces-622/B/B-in5
  94. +10
    -0
      codeforces/codeforces-622/B/B-rand.py
  95. +44
    -0
      codeforces/codeforces-622/B/B.py
  96. +2
    -0
      codeforces/codeforces-622/C/C-in1
  97. +2
    -0
      codeforces/codeforces-622/C/C-in2
  98. +2
    -0
      codeforces/codeforces-622/C/C-in3
  99. +32
    -0
      codeforces/codeforces-622/C/C1.py
  100. +34
    -0
      codeforces/codeforces-622/C/C2.py

+ 11
- 0
battledev/2020-1/A/A.py View File

@@ -0,0 +1,11 @@
from collections import Counter

n = int(input())
colors = Counter()

for i in range(n):
color = input().strip()
colors[color] += 1

first, second = colors.most_common(2)
print(first[0], second[0])

+ 7
- 0
battledev/2020-1/A/input1.txt View File

@@ -0,0 +1,7 @@
6
rouge
jaune
bleu
rouge
jaune
rouge

+ 28
- 0
battledev/2020-1/A/input2.txt View File

@@ -0,0 +1,28 @@
bleu
rose
bleu
rose
rose
bleu
bleu
rose
orange
orange
orange
rouge
bleu
violet
violet
rouge
rouge
orange
rose
jaune
rouge
vert
jaune
bleu
rouge
bleu
violet
rose

+ 28
- 0
battledev/2020-1/A/input3.txt View File

@@ -0,0 +1,28 @@
rouge
rose
rouge
rose
violet
violet
bleu
rouge
rose
violet
orange
bleu
rouge
rouge
orange
violet
violet
jaune
rose
vert
bleu
vert
rouge
vert
rose
vert
violet
violet

+ 2800
- 0
battledev/2020-1/A/input4.txt
File diff suppressed because it is too large
View File


+ 1
- 0
battledev/2020-1/A/output1.txt View File

@@ -0,0 +1 @@
rouge jaune

+ 1
- 0
battledev/2020-1/A/output2.txt View File

@@ -0,0 +1 @@
rose bleu

+ 1
- 0
battledev/2020-1/A/output3.txt View File

@@ -0,0 +1 @@
violet rose

+ 1
- 0
battledev/2020-1/A/output4.txt View File

@@ -0,0 +1 @@
orange rose

+ 22
- 0
battledev/2020-1/B/B.py View File

@@ -0,0 +1,22 @@
n = int(input())

cur_num = -1
cur_count = 0

max_num = -1
max_count = 0

for i in range(n):
i = int(input())
if cur_num != i:
if cur_count > max_count:
max_num = cur_num
max_count = cur_count
cur_num = i
cur_count = 1
else:
cur_count += 1

print(max_num)

+ 11
- 0
battledev/2020-1/B/input1.txt View File

@@ -0,0 +1,11 @@
10
5
3
3
4
9
9
9
9
9
6

+ 76
- 0
battledev/2020-1/B/input2.txt View File

@@ -0,0 +1,76 @@
75
1
6
6
6
4
4
4
7
7
3
3
1
1
1
1
1
8
9
9
9
9
5
5
5
5
7
4
6
6
6
6
1
1
1
1
1
1
7
6
9
9
9
9
9
5
3
3
3
3
3
2
2
8
8
8
8
8
5
2
2
2
2
1
1
1
3
3
3
3
3
3
3
8
8
7

+ 833
- 0
battledev/2020-1/B/input3.txt View File

@@ -0,0 +1,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
8
8
8
8
8
7
6
6
6
6
6
6
6
6
6
6
8
8
5
5
6
6
8
8
8
8
8
7
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
7
1
2
2
1
1
3
3
3
1
6
6
8
8
5
3
3
3
5
3
3
1
6
6
6
7
7
3
2
2
6
7

+ 1
- 0
battledev/2020-1/B/output1.txt View File

@@ -0,0 +1 @@
5

+ 1
- 0
battledev/2020-1/B/output2.txt View File

@@ -0,0 +1 @@
7

+ 1
- 0
battledev/2020-1/B/output3.txt View File

@@ -0,0 +1 @@
21

+ 1
- 0
battledev/2020-1/B/output4.txt View File

@@ -0,0 +1 @@
17

+ 33
- 0
battledev/2020-1/C/C.py View File

@@ -0,0 +1,33 @@
avail_slots = [[True] * 600 for i in range(5)]

n = int(input())

for i in range(n):
jour, hstart, mstart, hend, mend = map(int, input().replace(':', ' ').replace('-', ' ').split())

start = (hstart - 8) * 60 + mstart
end = (hend - 8) * 60 + mend

for i in range(start, end + 1):
avail_slots[jour - 1][i] = False

# Search for 60 min slot
for jour in range(5):
streak_start = 0
cur = 0

while cur < 600 and cur - streak_start + 1 < 60:
if not avail_slots[jour][cur]:
streak_start = cur + 1

cur += 1

if cur < 600:
hstart = int(streak_start / 60) + 8
mstart = streak_start % 60

hend = int(cur / 60) + 8
mend = cur % 60

print('{} {:02d}:{:02d}-{:02d}:{:02d}'.format(jour + 1, hstart, mstart, hend, mend))
break

+ 6
- 0
battledev/2020-1/C/input1.txt View File

@@ -0,0 +1,6 @@
5
1 08:45-12:59
2 08:24-10:54
1 14:45-14:47
3 09:56-16:25
5 15:16-16:28

+ 6
- 0
battledev/2020-1/C/input2.txt View File

@@ -0,0 +1,6 @@
5
1 08:00-17:59
1 12:23-16:27
4 09:49-16:14
2 11:47-13:36
2 12:47-15:05

+ 6
- 0
battledev/2020-1/C/input3.txt View File

@@ -0,0 +1,6 @@
5
5 08:00-17:59
1 08:00-17:59
3 08:00-17:59
2 09:00-17:59
4 08:00-17:59

+ 17
- 0
battledev/2020-1/C/input4.txt View File

@@ -0,0 +1,17 @@
16
1 09:42-11:00
4 12:06-12:36
2 17:52-17:58
1 14:50-15:14
1 08:00-17:59
2 08:00-12:28
2 17:16-17:41
1 08:10-13:01
2 13:29-17:59
5 17:55-17:56
4 08:00-17:59
3 13:00-13:38
2 10:38-10:59
5 08:00-17:59
5 16:27-17:34
3 08:00-17:59

+ 1001
- 0
battledev/2020-1/C/input5.txt
File diff suppressed because it is too large
View File


+ 1
- 0
battledev/2020-1/C/output1.txt View File

@@ -0,0 +1 @@
1 13:00-13:59

+ 1
- 0
battledev/2020-1/C/output2.txt View File

@@ -0,0 +1 @@
2 08:00-08:59

+ 1
- 0
battledev/2020-1/C/output3.txt View File

@@ -0,0 +1 @@
2 08:00-08:59

+ 1
- 0
battledev/2020-1/C/output4.txt View File

@@ -0,0 +1 @@
2 12:29-13:28

+ 1
- 0
battledev/2020-1/C/output5.txt View File

@@ -0,0 +1 @@
3 13:18-14:17

+ 114
- 0
battledev/2020-1/D/D.py View File

@@ -0,0 +1,114 @@
n = int(input())

sacha_deck = input().strip().split()
sacha_deck.reverse()

my_deck = input().strip().split()

def choose(sacha_deck, my_deck):
for my_card in my_deck:
next_sacha_deck = sacha_deck.copy()
wins = True

while wins and next_sacha_deck:
sacha_card = next_sacha_deck[-1]

# Égalité
draw = True
wins = False

# - Feu vs Eau: Eau l'emporte
if my_card == "feu" and sacha_card == "eau":
draw = False
wins = False
if my_card == "eau" and sacha_card == "feu":
draw = False
wins = True

# - Feu vs Plante: Feu l'emporte
if my_card == "feu" and sacha_card == "plante":
draw = False
wins = True
if my_card == "plante" and sacha_card == "feu":
draw = False
wins = False

# - Feu vs Glace: Feu l'emporte
if my_card == "feu" and sacha_card == "glace":
draw = False
wins = True
if my_card == "glace" and sacha_card == "feu":
draw = False
wins = False

# - Eau vs Plante: Plante l'emporte
if my_card == "eau" and sacha_card == "plante":
draw = False
wins = False
if my_card == "plante" and sacha_card == "eau":
draw = False
wins = True

# - Eau vs Sol: Sol l'emporte
if my_card == "eau" and sacha_card == "sol":
draw = False
wins = False
if my_card == "sol" and sacha_card == "eau":
draw = False
wins = True

# - Plante vs Poison: Plante l'emporte
if my_card == "plante" and sacha_card == "poison":
draw = False
wins = True
if my_card == "poison" and sacha_card == "plante":
draw = False
wins = False

# - Plante vs Sol: Sol l'emporte
if my_card == "plante" and sacha_card == "sol":
draw = False
wins = False
if my_card == "sol" and sacha_card == "plante":
draw = False
wins = True
# - Plante vs Sol: **PLANTE** l'emporte
# if my_card == "plante" and sacha_card == "sol":
# draw = False
# wins = True
# if my_card == "sol" and sacha_card == "plante":
# draw = False
# wins = False

# - Plante vs Vol: Plante l'emporte
if my_card == "plante" and sacha_card == "vol":
draw = False
wins = True
if my_card == "vol" and sacha_card == "plante":
draw = False
wins = False

if wins or draw:
next_sacha_deck.pop()

next_my_deck = my_deck.copy()
next_my_deck.remove(my_card)

if not next_sacha_deck:
# On a gagné !
return [my_card] + next_my_deck

next_my_deck = choose(next_sacha_deck, next_my_deck)

if next_my_deck:
# On a gagné recursivement !
return [my_card] + next_my_deck

return None

result = choose(sacha_deck, my_deck)

if result:
print(' '.join(result))
else:
print(-1)

+ 3
- 0
battledev/2020-1/D/input1.txt View File

@@ -0,0 +1,3 @@
3
feu sol plante
plante vol eau

+ 3
- 0
battledev/2020-1/D/input2.txt View File

@@ -0,0 +1,3 @@
3
eau plante feu
plante eau feu

+ 3
- 0
battledev/2020-1/D/input3.txt View File

@@ -0,0 +1,3 @@
3
eau poison feu
poison glace vol

+ 3
- 0
battledev/2020-1/D/input4.txt View File

@@ -0,0 +1,3 @@
5
sol feu sol sol sol
sol eau sol sol sol

+ 3
- 0
battledev/2020-1/D/input5.txt View File

@@ -0,0 +1,3 @@
5
plante feu glace glace eau
sol eau glace vol vol

+ 3
- 0
battledev/2020-1/D/input6.txt View File

@@ -0,0 +1,3 @@
10
plante eau sol glace poison sol feu sol sol vol
feu eau sol feu plante sol sol plante sol plante

+ 3
- 0
battledev/2020-1/D/input7.txt View File

@@ -0,0 +1,3 @@
10
sol glace poison sol sol vol poison plante plante glace
plante eau poison poison feu vol poison glace sol plante

+ 1
- 0
battledev/2020-1/D/output1.txt View File

@@ -0,0 +1 @@
eau plante vol

+ 1
- 0
battledev/2020-1/D/output2.txt View File

@@ -0,0 +1 @@
plante eau feu

+ 1
- 0
battledev/2020-1/D/output3.txt View File

@@ -0,0 +1 @@
-1

+ 1
- 0
battledev/2020-1/D/output4.txt View File

@@ -0,0 +1 @@
sol eau sol sol sol

+ 1
- 0
battledev/2020-1/D/output5.txt View File

@@ -0,0 +1 @@
sol eau glace vol vol

+ 1
- 0
battledev/2020-1/D/output6.txt View File

@@ -0,0 +1 @@
feu eau sol plante plante feu sol sol sol plante

+ 1
- 0
battledev/2020-1/D/output7.txt View File

@@ -0,0 +1 @@
plante eau poison poison feu vol poison glace sol plante

+ 31
- 0
battledev/2020-1/E/E.py View File

@@ -0,0 +1,31 @@
n, k = map(int, input().split())
brochette = input().strip()

m = [[-1] * (n + 1) for i in range(k + 1)]
m[0][n] = n + 1

for cur_k in range(1, k + 1):
for start in range(n - cur_k, -1, -1):
if m[cur_k][start] == -1:
for end in range(start + 1, n + 1 - (cur_k - 1)):
is_palindrome = True

for cur in range(0, (end - start) // 2):
if brochette[start + cur] != brochette[end - 1 - cur]:
is_palindrome = False

if is_palindrome:
if m[cur_k - 1][end] != -1:
m[cur_k][start] = end
break

cur_k = k
start = 0

if m[cur_k][start] == -1:
print('IMPOSSIBLE')
else:
while start != n + 1 and m[cur_k][start] != -1:
print(brochette[start : m[cur_k][start]], end = ' ')
start = m[cur_k][start]
cur_k -= 1

+ 2
- 0
battledev/2020-1/E/input1.txt View File

@@ -0,0 +1,2 @@
24 10
uvxuuxvvhikinwnjponopjfd

+ 2
- 0
battledev/2020-1/E/input2.txt View File

@@ -0,0 +1,2 @@
6 3
abacdc

+ 2
- 0
battledev/2020-1/E/input3.txt
File diff suppressed because it is too large
View File


+ 2
- 0
battledev/2020-1/E/input4.txt
File diff suppressed because it is too large
View File