10 100
1 101 10000
41 100 7733
92 100 3306
46 100 6378
49 69 4702
23 73 6043
87 100 7712
25
<36 bytes omitted>
用户输出
16017
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#5391 | #1049. 澄闪单挑骑士 | Wrong Answer | 20 | 4662 ms | 10900 K | Python 3 / 4.0 K | s230026152 | 2024-04-27 15:19:19 |
import re,os
from io import BytesIO, IOBase
import random
import sys
from math import ceil,floor,fmod,gcd,sqrt,inf
from bisect import bisect_left
from collections import defaultdict,Counter,deque,OrderedDict
# from functools import cache, reduce, cmp_to_key
from itertools import accumulate, combinations, permutations
from heapq import nsmallest, nlargest, heappushpop, heapify, heappop, heappush
from copy import deepcopy
from typing import *
from string import ascii_lowercase, ascii_uppercase
# 快读区块大小
BUFSIZE = 4096
# 判断是否本地
LOCAL="--open17" in sys.argv
# 可能会导致pypy产生TLE
# if "PyPy" in sys.version:
# import pypyjit; pypyjit.set_param('max_unroll_recursion=-1')
# 调试递归极限
limits = [100000, 10000, 5000, 2000]
for limit in limits:
try:
sys.setrecursionlimit(limit)
break
except:
continue
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
def fstream(func):
def wrapper(is_local):
input_file = open('data.in', 'r', encoding='utf-8') if is_local else sys.stdin
output_file = open('data.out', 'w', encoding='utf-8') if is_local else sys.stdout
sys.stdin = IOWrapper(input_file)
sys.stdout = output_file
func()
sys.stdin = sys.__stdin__
sys.stdout = sys.__stdout__
if is_local:
input_file.close()
output_file.close()
return wrapper
input = lambda: sys.stdin.readline().rstrip("\r\n")
def I():
return input()
def II():
return int(input())
def MII():
return map(int, input().split())
def LI():
return list(input().split())
def LII():
return list(map(int, input().split()))
def for_t(func):
def wrapper():
T=II()
for _ in range(T):
func()
return wrapper
@fstream
# @for_t
def solve():
n,T=MII()
s=0
a=[0 for _ in range(T+1)]
for _ in range(n):
l,r,v=MII()
# print(l,r,v)
s+=v
if r>=l+T:
a[l%T]+=v
# print(a)
continue
l%=T
r%=T
if l<=r:
a[l]+=v
a[r+1]-=v
else:
a[r]+=v
a[r+1]-=v
a[l]+=v
# print(a)
# print(a)
t=0
ans=a[0]
for i in range(1,T+1):
a[i]+=a[i-1]
if a[i]>=ans:
ans=a[i]
t=i
# print(t,s-ans)
print(s-ans)
return 0
solve(LOCAL)
10 100
1 101 10000
41 100 7733
92 100 3306
46 100 6378
49 69 4702
23 73 6043
87 100 7712
25
<36 bytes omitted>
用户输出
16017
系统信息
Exited with return code 0
10 64
1 65 10000
17 42 3144
33 49 9890
36 84 4194
26 34 8412
69 100 410
37 70 2864
76 100 24
<31 bytes omitted>
用户输出
11703
系统信息
Exited with return code 0
10 48
1 49 10000
97 100 7069
76 77 1699
43 83 8986
33 76 5559
1 15 6863
58 93 2513
75 89 728
<29 bytes omitted>
用户输出
20536
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
10 30
1 31 10000
81 100 1340
55 80 6001
24 30 2308
46 55 6497
61 62 6551
53 81 2457
24 47 36
<29 bytes omitted>
用户输出
6551
系统信息
Exited with return code 0
100000 55321
1 55322 10000
92767 93972 9423
39615 65067 3287
39600 75610 518
23905 53075 7508
<1804636 bytes omitted>
用户输出
226747734
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 95358
1 95359 10000
23244 100000 5261
43764 92433 6342
43017 100000 7069
42837 88325 122
<1825186 bytes omitted>
用户输出
238074644
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 74360
1 74361 10000
69677 95261 4304
27070 55663 4713
32550 51013 4984
10216 22943 4993
<1814284 bytes omitted>
用户输出
208190447
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 38789
1 38790 10000
98022 100000 3352
79937 82740 7525
95645 100000 1036
16557 30899 446
<1795842 bytes omitted>
用户输出
243972969
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 80539
1 80540 10000
65800 100000 9092
37793 60084 5318
50008 57375 6007
44732 100000 222
<1817384 bytes omitted>
用户输出
213287695
系统信息
Exited with return code 0
100000 30028
1 30029 10000
23811 53548 3920
40078 48594 5185
92683 100000 6506
32589 32819 6140
<1790946 bytes omitted>
用户输出
274577823
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 73608
1 73609 10000
320705086 320751541 708
946013690 946069996 5908
983592185 983650067
<2562863 bytes omitted>
用户输出
249722967
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 14700
1 14701 10000
870373521 870385579 6895
958869085 958879560 5910
282932085 282941579
<2563321 bytes omitted>
用户输出
251749508
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 20770
1 20771 10000
743514443 743535045 7272
140482909 140483822 2267
860424278 860430441
<2562742 bytes omitted>
用户输出
249833673
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 4856
1 4857 10000
338809197 338812574 9471
952161151 952163032 594
443826723 443830742 66
<2562710 bytes omitted>
用户输出
249807862
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 98278
1 98279 10000
101182687 101242677 2807
16962413 16963217 565
650929493 650966155 27
<2562904 bytes omitted>
用户输出
250212408
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 54072
1 54073 10000
648896046 648933008 3509
794387806 794432685 3419
586278290 586312694
<2563160 bytes omitted>
用户输出
250094997
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 69721
1 69722 10000
523010622 523041076 4887
518646206 518713613 941
496757432 496785634
<2563046 bytes omitted>
用户输出
248273813
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 72333
1 72334 10000
380598300 380658455 3288
978269493 978305298 9358
23755531 23805179 3
<2563054 bytes omitted>
用户输出
249850850
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
100000 40402
1 40403 10000
710419274 710448781 1634
727860345 727876872 9612
966474456 966481445
<2563149 bytes omitted>
用户输出
247146914
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0