| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
|
0
I checked it on a debugger and i=59 is where it overflowed. Also the same code where I substituted (1ll<<i) to poweroftwo(i) gave me an AC, weird behaviour |
|
0
Yep, I've used 1ll in my wrong submission |
|
0
My submission to E 242474581. I got long long overflow when I had (1ll<<i) for calculating power of 2s (Specifically at i=59). However, it did not overflow when I calculated poweroftwos by arithmetic (as in submission, the dp array). Any suggestions why there was an overflow for (1<<i) case? 242470568 |
|
0
My deepest condolences and may she rest in peace. |
|
0
Check the editorial, this question has been answered a million times here. |
|
0
You need max primality, so maximum no of subarrays with mex as prime. Which prime numbers are easiest to get in an mex? It's 2 and 3. But to get to 2 (or 3) as MEX you need 1 in the subarray as well. If you think about it, an element can affect the maximum subarrays if its in the middle of the array. At the ends of an array, you have n subarrays you can construct using the first (or last) element of an array. However, this number goes up as we go towards the middle and maximises at the centre. Hence, you take 1 as the middle element. Now you need to make sure 2 and 3 together are included in the least number of subarrays (since MEX will then come out as 4, which is not a prime). How do you do that? By taking them as the first and last element in the array. |
|
0
1846-C - Rudolf and the Another Competition Any idea why my submission gets a TLE here. Time complexity is O(n*mlogm). 212937677 Spoiler import sys from os import path input = sys.stdin.readline if(path.exists('input.txt')): sys.stdin = open("input.txt","r") sys.stdout = open("output.txt","w") def listInp(): return list(map(int,input().split())) def mapInp(): return map(int,input().split()) for _ in range(int(input())): n,m,h = mapInp()
data = []
for i in range(n):
data.append(sorted(listInp()))
psums = []
for i in range(n):
x = [0]
for j in range(m):
if data[i][j] + x[-1] <= h:
x.append(data[i][j] + x[-1])
else:
break
psums.append([len(x)-1,sum(x),i])
psums.sort(key=lambda x:(-x[0],x[1]))
# print(psums)
for i in range(n):
if psums[i][2] == 0:
print(i+1)
break |
|
0
Can someone help me in this interactive problem, couldn't figure out why I'm getting a TLE. https://codeforces.me/gym/101021/problem/1 My submisision: 212177668 Spoiler import sys from os import path if(path.exists('input.txt')): sys.stdin = open("input.txt","r") sys.stdout = open("output.txt","w") def listInp(): return list(map(int,input().split())) def mapInp(): return map(int,input().split()) l = 1 r = int(1e6) while l<r: mid = (l+r)//2 print(mid, flush=True) x = input() if x == '<': r = mid-1 else: l = mid print(f"! {l}", flush=True) |
|
+3
Okay, thanks! |
|
0
Can someone tell me why my code was giving TLE for 1843D - Apple Tree. All I did was globally define the graph and cnt array similar to the tutorial solution and it worked then. This is my initial submission: 210536302. This is the final accepted submission: 210538893 |
|
0
You're supposed to ask the same questions to all students, so if you ask questions 2,3,4,5. Student 1 gets a score -4 Student 2,3 get a score of -2. Hence difference is 2 in this case. |
|
0
Thanks,I interchanged n and m I'm so dumb |
|
0
Could someone tell why I'm getting "wrong output format illegal query (test case 1)" in this code? |
|
0
19th token in second test case. Look at the 19th test case |
| Name |
|---|


