It's Python day !!!
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
```bash
|
```bash
|
||||||
g++ "code.cpp" -o a.out && ./a.out < input.txt && rm a.out
|
g++ "code.cpp" -o a.out && ./a.out < input.txt && rm a.out
|
||||||
|
cses-cli submit -c problemset -t 1640 src/CSES.\ 1640.py
|
||||||
```
|
```
|
||||||
22
src/A. Organizing SWERC.py
Normal file
22
src/A. Organizing SWERC.py
Normal 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
13
src/CSES. 1640.py
Normal 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()
|
||||||
Reference in New Issue
Block a user