icpc probs
This commit is contained in:
parent
4c531b965f
commit
69d48861b1
17 changed files with 448 additions and 2 deletions
32
kattis/23-9-24/f/solution.py
Normal file
32
kattis/23-9-24/f/solution.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import sys
|
||||
from collections import Counter
|
||||
|
||||
|
||||
def solve() -> None:
|
||||
counter: Counter[str] = Counter()
|
||||
|
||||
ans = []
|
||||
|
||||
lines = sys.stdin.readlines()
|
||||
for line in lines:
|
||||
first, last = line.split()
|
||||
|
||||
counter[first] += 1
|
||||
|
||||
ans.append((last, first))
|
||||
|
||||
ans.sort()
|
||||
|
||||
for last, first in ans:
|
||||
if counter[first] > 1:
|
||||
print(f"{first} {last}")
|
||||
else:
|
||||
print(first)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
solve()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue