結果
問題 |
No.2210 equence Squence Seuence
|
ユーザー |
![]() |
提出日時 | 2025-03-31 18:00:05 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,758 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 82,628 KB |
実行使用メモリ | 94,844 KB |
最終ジャッジ日時 | 2025-03-31 18:01:02 |
合計ジャッジ時間 | 4,765 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 24 |
ソースコード
import sys from functools import cmp_to_key def main(): N, K = map(int, sys.stdin.readline().split()) A = list(map(int, sys.stdin.readline().split())) # This function compares two indices by their corresponding X sequences def compare(i, j): if i == j: return 0 # Iterate through elements of X_i and X_j to find the first difference ii = 0 # current position in X_i and X_j while True: # Skip the current index for each sequence xi = ii if ii < i else ii + 1 xj = ii if ii < j else ii + 1 elem_i = A[xi] if xi < N else None elem_j = A[xj] if xj < N else None # Compare elements at current position if elem_i < elem_j: return -1 elif elem_i > elem_j: return 1 else: ii += 1 # Break if both sequences have been exhausted if (xi >= N-1 and xj >= N-1) or ii >= (N-1): break # All elements are the same up to the length of the shorter sequence # So, the one with smaller original index comes first return -1 if i < j else 1 # Create a list of indices from 0 to N-1 (original indices) indices = list(range(N)) # Sort the indices based on the compare function sorted_indices = sorted(indices, key=cmp_to_key(compare)) # Get the K-th smallest index (converting K from 1-based to 0-based) selected = sorted_indices[K-1] # Generate the output sequence by skipping the selected index output = [str(A[i]) for i in range(N) if i != selected] print(' '.join(output)) if __name__ == "__main__": main()