|
|
Общий форумimport math import operator n = int(input()) s = input() l1 = s.split(" ") x = int(l1[0]) y = int(l1[1]) sp = {} for i in range(n-1): s = input().split(" ") x1 = int(s[0]) y1 = int(s[1]) dx = x1-x dy = y1-y dl = math.sqrt(math.pow(dx,2)+math.pow(dy,2)) a = math.degrees(math.asin(dy/dl)) #print(a) sp.update({i+2:a}) sorted_tuples = sorted(sp.items(), key=operator.itemgetter(1)) #print(sorted_tuples) print("1") print(sorted_tuples[len(sorted_tuples)//2][0]) 2 1 2 Ответ: 1 Этот тест может быть крайним случаем в вашем решении так как уже на такой тест и схожие: 3 2 2 3 Ответ: 2 Edited by author 05.05.2021 06:45 Я получил такой вердикт, выводя "Ask Shiftman for help." как только встречалось в цикле подходящее условие, вместо того чтобы проверить все отрезки до конца на наличие случая "Let's search for another office." m=[] m2=[] for tik in range(3): n=int(input()) m1=input().split() for i in m1: if i not in m: m.append(i) elif i in m: if i not in m2: m2.append(i) print(len(m)-len(m2)) I don't know why this program doesn't work. Edited by author 03.05.2021 00:22 If you put two books on a bookshelf by facing binding side (book number) outwards i.e facing person, then this problem statement makes sense. The coordinates are given in the traversal order. Try this: 3 3 6 1 1 1 2 1 3 2 1 2 2 2 3 Should be: 1 input: 5 5 1 2 0 2 3 1 2 4 1 3 4 1 4 5 2 one possible output: 1 2 3 5 wrong output: 1 2 3 4 5 Don't forget that the output also needs to have as few edges as possible! Obviously, size of answer is always n-1 I checked them using my AC algorithm 6 100110 000111 -> Impossible 10 1001100110 0101010101 -> 11111111112222222222 10 1001110000 0011111010 -> 11111211221212122222 11 01011100000 01111011001 -> 1111121112121212222222 14 10011111100101 00000110101010 -> 1111121212121111112222222222 18 100111111001010010 000001101010100111 -> 111112121212111111222222222222121112 18 100111111001010011 000001101010100011 -> Impossible try this one 2 2 1 1 3 2 1 2 3 3 1 2 2 4 1 2 TRY THIS ONE 6 7 1 2 3 2 3 4 3 4 3 1 3 4 4 5 33 5 6 3 4 6 -2 IMPOSSIBLE Edited by author 27.04.2021 21:36 Edited by author 27.04.2021 21:37 ........ .B.B...B ....W... .B.B.B.. ........ .B.B.B.. ........ ........ ans:1 ..W.W... .B.B.B.. ........ .B.B.B.. ........ .B.B.B.. ........ ........ ans:2 ..W.W... .B.B.B.. W.W.W.W. .B.B.B.. W.W.W.W. .B.B.B.. ..W.W... ........ ans:6 input: 3 1 3 2 2 3 1 output: 1 3 2 " along one of the sides of the playing board" should be removed since it gives the impression that you can only move tiles next to the edges of the board. For more clarity it could say that you can move them parallel to one side of the board, or that you can shift up to four tiles as permitted by the empty square. 2 2 2 2 1 1 6 7 1 7 D U R U --- 1 3 3 2 3 2 1 2 1 7 1 9 8 7 5 4 L D U R U R L L U ----- 8 Thanks for the tests! :) They're not formatted correctly though, here are the valid ones: 2 2 2 2 1 1 6 7 1 7 DU RU --- 1 3 3 2 3 2 1 2 1 7 1 9 8 7 5 4 LDU RUR LLU ----- 8 read(p,q); for i:=2 to 10000000 do begin a:=i/100*p; b:=i/100*q; a1:=trunc(a); b1:=trunc(b); if (b1-a1)>=0.99 then begin write(i); halt; end; end; why WA ? Me,too! Edited by author 24.04.2021 19:44 The limits on the number of hailstones k (1 ≤ k ≤ 100) is not specified. use sqrt(2.00) instead of 1.41421356 This will make your program accepted. I've tried it. This probably helps 3 1 0 0 2 2 3 3 1 3 Ans: YES 3 1 0 5 2 5 3 5 1 2 Ans: NO |
|
|