結果
問題 |
No.1795 AtCoder Heuristic Rating coloring
|
ユーザー |
![]() |
提出日時 | 2021-12-23 23:37:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 836 ms / 2,000 ms |
コード長 | 798 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 37,236 KB |
最終ジャッジ日時 | 2024-09-20 03:09:58 |
合計ジャッジ時間 | 17,546 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 54 |
コンパイルメッセージ
Main.py:12: SyntaxWarning: invalid escape sequence '\d' assert(re.fullmatch("^[1-9]+\d*$",A)!=None) Main.py:14: SyntaxWarning: invalid escape sequence '\w' assert(re.fullmatch("^\w+$",S)!=None) Main.py:21: SyntaxWarning: invalid escape sequence '\d' assert(re.fullmatch("^[1-9]+\d*$",B)!=None) Main.py:23: SyntaxWarning: invalid escape sequence '\w' assert(re.fullmatch("^\w+$",T)!=None)
ソースコード
import re from collections import Counter def main(): N,M=map(int,input().split()) assert(0<=N<=50000) assert(1<=M<=50000) d=Counter() S_set=set() T_set=set() for i in range(N): S,A=input().split() assert(re.fullmatch("^[1-9]+\d*$",A)!=None) assert(1<=int(A)<=9999) assert(re.fullmatch("^\w+$",S)!=None) assert(2<=len(S)<=16) S_set.add(S) d[S]=int(A) assert(len(S_set)==N) for i in range(M): T,B=input().split() assert(re.fullmatch("^[1-9]+\d*$",B)!=None) assert(1<=int(B)<=9999) assert(re.fullmatch("^\w+$",T)!=None) assert(2<=len(T)<=16) assert(d[T]<=int(B)) T_set.add(T) d[T]=int(B) assert(len(T_set)==M) ans=sorted(list(d.items()),key=lambda x:x[0]) for user,rate in ans: print(user,rate) return main()