It's Python day !!!

This commit is contained in:
2026-04-06 20:54:45 +02:00
parent 4f4180afc7
commit c0aa29791f
3 changed files with 36 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
```bash
g++ "code.cpp" -o a.out && ./a.out < input.txt && rm a.out
cses-cli submit -c problemset -t 1640 src/CSES.\ 1640.py
```

View File

@@ -0,0 +1,22 @@
def solve():
n = int(input())
D = {}
for i in range(n):
b, d = map(int, input().split())
if d in D:
if D[d] < b:
D[d] = b
else:
D[d] = b
tb = 0
for i in range(1, 11):
if not i in D:
return print("MOREPROBLEMS")
else:
tb += D[i]
return print(tb)
t = int(input())
for _ in range(t):
solve()

13
src/CSES. 1640.py Normal file
View File

@@ -0,0 +1,13 @@
n, x = map(int, input().split())
L = list(map(int, input().split()))
def solve():
D = {}
for i in range(n):
if L[i] in D:
return print(i + 1, D[L[i]] + 1)
else:
D[x - L[i]] = i
return print("IMPOSSIBLE")
solve()