結果
| 問題 | 
                            No.2662 Installing Cell Towers
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-03-06 15:51:07 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 997 bytes | 
| コンパイル時間 | 93 ms | 
| 最終ジャッジ日時 | 2024-09-29 18:16:33 | 
| 合計ジャッジ時間 | 644 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
35d6b6a11e94
[/j_bin/judge_tool judge 0 30000 ../CompileMemory.txt /dev/null sud /dev/null _ pypy3 -mpy_compile Main.py]
open /home/yuki2006/gopath/src/yukicoder/judge/lang/lang.csv: no such file or directory
goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x5e
main.main.func1()
	/home/yuki2006/gopath/src/yukicoder/judge/main.go:20 +0x57
panic({0x7661e0?, 0xc00006eb70?})
	/usr/local/go/src/runtime/panic.go:770 +0x132
yukicoder/env.InitLangCommands(0x0)
	/home/yuki2006/gopath/src/yukicoder/env/lang.go:57 +0x3a5
main.main()
	/home/yuki2006/gopath/src/yukicoder/judge/main.go:42 +0x65
            
            ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
n,m = map(int,input().split())
check = [[] for i in range(n)]
c = [0 for i in range(n)]
for i in range(m):
    p,q = map(int,input().split())
    p -= 1
    check[p].append(q)
r = [0 for i in range(n)]
temp = 0
cnt = 0
h = []
for i in range(n):
    for j in check[i]:
        temp += j
        cnt += 1
        heapq.heappush(h,i+j)
    r[i] = temp
    while h and h[0] == i:
        cnt -= 1
        heapq.heappop(h)
    temp = max(temp-cnt,0)
l = [0 for i in range(n)]
temp = 0
cnt = 0
h = []
for i in reversed(range(n)):
    for j in check[i]:
        temp += j
        cnt += 1
        heapq.heappush(h,-(i-j))
    l[i] = temp
    while h and h[0] == -i:
        cnt -= 1
        heapq.heappop(h)
    temp = max(temp-cnt,0)
for i in range(n):
    print(l[i]+r[i]-sum(check[i]),end=' ')
#0 1 3 4 5 5 3 2 1 0