結果

問題 No.2662 Installing Cell Towers
ユーザー hato336
提出日時 2024-03-06 15:39:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 133 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 89,728 KB
最終ジャッジ日時 2026-04-16 01:24:16
合計ジャッジ時間 5,124 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 = [0 for i in range(n)]
for i in range(m):
    p,q = map(int,input().split())
    p -= 1
    check[p] += q
r = [0 for i in range(n)]
temp = 0
for i in range(n):
    temp += check[i]
    r[i] = temp
    temp = max(temp-1,0)

l = [0 for i in range(n)]
temp = 0
for i in reversed(range(n)):
    temp += check[i]
    l[i] = temp
    temp = max(temp-1,0)
for i in range(n):
    print(l[i]+r[i]-check[i],end=' ')
0