Submission #1239859

#TimeUsernameProblemLanguageResultExecution timeMemory
1239859woeCircle Passing (EGOI24_circlepassing)Pypy 3
0 / 100
134 ms48816 KiB
def solve_subtask_1(N, best_friend_pair, queries): # Best friend pair consists of (k, k + N) k = best_friend_pair[0] results = [] for x, y in queries: # If x is the best friend of y (or vice versa), the ball is passed directly if (x == k and y == k + N) or (x == k + N and y == k): results.append(1) # If they are opposite in the circle, the ball takes N passes elif (x == k and y == k + N) or (x == k + N and y == k): results.append(1) else: results.append(-1) # In case of an unexpected condition return results # Example input N = 4 best_friend_pair = [0] # Best friends are at positions (0, 4) queries = [(0, 4), (1, 5)] # Query 1: from 0 to 4, Query 2: from 1 to 5 # Call the solve function for the first subtask results = solve_subtask_1(N, best_friend_pair, queries) # Output the results for result in results: print(result)

Compilation message (stdout)

Compiling 'Main.py'...

=======
  adding: __main__.pyc (deflated 34%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...