diff --git a/README.md b/README.md index 96836a0..5775efd 100644 --- a/README.md +++ b/README.md @@ -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 ``` \ No newline at end of file diff --git a/src/A. Organizing SWERC.py b/src/A. Organizing SWERC.py new file mode 100644 index 0000000..81fe1b8 --- /dev/null +++ b/src/A. Organizing SWERC.py @@ -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() \ No newline at end of file diff --git a/src/CSES. 1640.py b/src/CSES. 1640.py new file mode 100644 index 0000000..35c3faa --- /dev/null +++ b/src/CSES. 1640.py @@ -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()