Common BoardDon't forget to add primes <= k how can it be improved???? n = int(input()) sp = [] a = [] c = 0 for i in range(n): sp.append(int(input())) m = int(input()) for i in range(m): x = int(input()) if x in sp: c += 1 print(c) if a = 0 and b = 0 => r = 0 and q every complex number => count solation equation = infinity I would like to know if I can reset my progress here. I want to start afresh, but as I don't see a way to delete accounts, I thought that, at least, resetting my progress would be enough, but I can't do that either! Thanks in advance for your help! Edited by author 14.02.2025 08:40 You can request deleting your account by writing an email to support > The student’s home is located at the coordinates (1, 1), and the university is at the coordinates (N, M). It means, for example, if N == 1 && M == 1 then university have same coordinates as home. Of course we can not use any roads in such case. But according to the sentence: > There are a total of N streets running from north to south and M streets running from west to east. there are some roads that can not be used. I think there should be N - 1 streets running from north to south and M - 1 streets running from west to east. int main(){ int x, y; cin >> x >> y; if ((x*y-1)%2==1) cout << "[:=[first]"; else cout << "[second]=:]"; return 0; } #include <iostream> using namespace std; int main () { int m,n; cin>>m>>n; if((m*n)%2==0)cout<<"[:=[first]"; else cout<<"[second]=:]"; return 0; } can I have hint, at addflash@dmc.chat Please > > i found my mistake Edited by author 20.11.2005 00:44 I have wa#9 but I can't found mistake :( what is test 9? 3 -1 -1 1 try this I tried this and I get the correct answer, but test 9 code fails. Here is the code that fails test 9: from typing import List potentials: List[int] = [] N: int = int(input()) for p in range(N): potentials.append(int(input())) def list_max_right_sum(lst: List[int]) -> List[int]: amount: int = 0 left_min: int = 0 left_max_index: int = 0 k: int = 0 for i, p in enumerate(lst): amount += p k = i + 1 if amount < left_min: left_min = amount left_max_index = i + 1 return lst[left_max_index: k] result: List[int] = list_max_right_sum(potentials) result.reverse() result = list_max_right_sum(result) print(sum(result)) Что означает отношения квадрата и куба и что за число n дано число n, найти a и b где n = a^2/b^3 Test 13 is an empty sequence :))) Thanks! Edited by author 25.02.2025 08:48 3-edge connected components of graph. A Simple 3-Edge Connected Component Algorithm by Yung H. Tsin. But I self do not found this article :) I have a stupid idea to solve this problem: first ,dfs a tree, then for each node compute the hash_value of edge set which cover this node.. for each query a,b if for every node on the path of (a,b) the set of edge cover by this node is not equal to any node outside the path of (a,b) and times of edge segments covered the path >=2 then result is Yes,otherwise it is no.. I'll try to use president tree to implement this idea... hope there is nothing wrong.. Edited by author 05.12.2016 14:35 Edited by author 05.12.2016 14:35 WA on test # 18,any one help?? AC 0.421s O(n*log(n)^2) its log(n)^2 because I use heavy_light decomposion+segment_tree ccz181078 has give a random solution to the sub problem of this problem:: give a tree with n node,n<=50000 for every edege there is a color 1<=c<=50000, give q<=50000 queries ,for each query give two node a,b judge for every color on path a-->b this color appear only on the path a--->b ,not outside path a--->b. sol :for every edge gives a random 32 bit number, so that for every col xor of edge with this color is zero.. for each query just judge if xor of random number on this path is zero. if it is ,answer is Yes, otherwise it is No You're wrong. The answer may be "Yes" but nodes not in one 3-edge connected component # works on pypy import sys n, m = sys.stdin.readline().split() n, m = int(n), int(m) k = int(sys.stdin.readline()) can_diag = {tuple(map(int, sys.stdin.readline().split())):0 for _ in range(k)} city_map = [[0]*(n+1) for _ in range(m+1)] for i in range(n+1): city_map[0][i] = i*100 for i in range(m+1): city_map[i][0] = i*100 for i in range(1, m+1): for j in range(1, n+1): if (j, i) in can_diag: city_map[i][j] = 100*(2**0.5)+city_map[i-1][j-1] else: city_map[i][j] = 100+min(city_map[i][j-1], city_map[i-1][j]) print(round(city_map[-1][-1])) i think i get this wa by precision, i try to use long double but this dont enough, maybe i have specific algorithm for this problem |
|