|
|
Common BoardAdd test. My solution O(n^2) on python AC admins is died Edited by author 13.12.2019 06:53 Check all 2x2 squares A[i][j] A[i][j+1] A[i+1][j] A[i+1][j+1] Make sure you always can cover this square at least one of the methods x x y y or x y x y Edited by author 10.12.2019 14:13 Edited by author 10.12.2019 14:15 Check that you are dealing with an undirected graph! You need to minimize number of visited islands firstly. Test: 3 3 1 3 1 3 99 1 2 0 2 3 0 Answer: 2 0.99 1 3 Let we visit towns by distance ascending: 1, 2, 3 So total fine is : (6+5) + (5*2+3*2) + 3 = 11 + 16 + 3 = 30 Where am I wrong? My mistake: Total fine is : (6+5) + (5*2+3*2) + 3*3 = 11 + 16 + 9 = 36 What is test 8? What input ? Edited by author 13.11.2009 15:02 Edited by author 13.11.2009 15:02 Now all ok? i find my mistake. I solved the problem geometrically in Microsoft VS C ++. At first, my solution was WA 8, but after I added 100 to the input coordinates, I started getting WA 38. But as I did not try to work with accuracy, I still got WA 38. I tried everything. Please tell me, is 38 test really drawn up correctly? Or at least tell me what my mistake is. I would like to see a test similar to 38. I am sure that I solved the problem correctly you must sort in ascend and descend order !!! AC programm: 6 1 5 4 3 2 6 ans: 4 Edited by author 10.02.2011 11:10 deleted Edited by moderator 11.08.2022 18:56 var m,n,i,j,k,s,l:integer; A: array [1..15000] of LongInt; B: array [1..1000000] of LongInt; begin s:=0; readln(n); for i:=1 to n do readln(A[i]); readln(m); for j:=1 to m do begin readln(B[j]); end; i := 1; j := n; k := 1; for l:=1 to m do begin while (i <=j) do begin k := (i + j) div 2; if B[l] > A[k] then i := k + 1 else j := k -1;
end; if A[k] = B[l] then s:=s+1; end; writeln(); writeln(s); readln; end. Try this test: 3 10 11 12 3 12 11 10 result must be 3 or no :) Try this test: 3 10 11 12 3 12 11 10 In your program teacher's dates should not be the same. But once you will fix this your program won't pass test 8 because of time limit. You have to use binary search. And in binary search there can be the same teacher's dates. My code doesn't leave empty line after the last query. What can be the cause of WA2? Seeing many people also got WA2 :(( Edited by author 21.04.2017 07:33 Edited by author 21.04.2017 07:33 if no word found with any query dont print any new line Can someone help me? Please? I do it with Python3 ,and does not print out empty line after last queue here's my code: def getSecond(temp): return temp[1] if __name__ == '__main__': while True: try: N = int(input()) Words = [] for n in range(N): Words.append(input().split()) Words[n][1] = int(Words[n][1]) M = int(input()) Beginners = [] for m in range(M): Beginners.append(input()) for mm in range(M): start = list(Beginners[mm]) matchs = [] for nn in range(N): word = list(Words[nn][0]) flag = True for s in range(len(start)): if start[s] != word[s]: flag = False break if(flag): matchs.append(Words[nn]) if matchs != []: matchs.sort() matchs.sort(key = getSecond, reverse = True) count = 0 for match in matchs: if count > 10: break print(match[0]) count += 1
if mm != M-1: print() except: break
if no word found with any query dont print any new line You need to find formula for progression - it is a square equation, and then just solve it. I this problem you can choice X+Z, Y or X, Y+Z if you have A, B, C Edited by author 05.12.2019 20:58 Task: old bus routes can be equal to 1, and bus stops can also be equal to 1 .... Does it make any sense? Really? What did the authors think of when they put such conditions? my email is LiuyangElvis@gmail.com thanks for help! 10 7 BA AA AA AA AA AA AB AB AB AB AB ANSWER:NO Good luck! |
|
|