Submission #7086421
Source Code Expand
import sys import heapq from operator import itemgetter from collections import deque, defaultdict from bisect import bisect_left, bisect_right input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) MOD = 10**9 + 7 def diff(s): if s == 'a': return 0 if s == 'b': return 25 if s == 'c': return 24 if s == 'd': return 23 if s == 'e': return 22 if s == 'f': return 21 if s == 'g': return 20 if s == 'h': return 19 if s == 'i': return 18 if s == 'j': return 17 if s == 'k': return 16 if s == 'l': return 15 if s == 'm': return 14 if s == 'n': return 13 if s == 'o': return 12 if s == 'p': return 11 if s == 'q': return 10 if s == 'r': return 9 if s == 's': return 8 if s == 't': return 7 if s == 'u': return 6 if s == 'v': return 5 if s == 'w': return 4 if s == 'x': return 3 if s == 'y': return 2 if s == 'z': return 1 def sol(): S = list(input().strip()) K = int(input()) for i, s in enumerate(S): if s == 'a': continue else: if diff(s) <= K: S[i] = 'a' K -= diff(s) last = K % 26 S[-1] = chr(ord(S[-1]) + last) print(*S, sep='') sol()
Submission Info
Submission Time | |
---|---|
Task | C - Next Letter |
User | OKCH3COOH |
Language | PyPy3 (2.4.0) |
Score | 400 |
Code Size | 1294 Byte |
Status | AC |
Exec Time | 454 ms |
Memory | 71928 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 164 ms | 38256 KB |
0_01.txt | AC | 167 ms | 38256 KB |
0_02.txt | AC | 165 ms | 38256 KB |
1_00.txt | AC | 166 ms | 38256 KB |
1_01.txt | AC | 168 ms | 38256 KB |
1_02.txt | AC | 167 ms | 38256 KB |
1_03.txt | AC | 168 ms | 38256 KB |
1_04.txt | AC | 165 ms | 38384 KB |
1_05.txt | AC | 164 ms | 38256 KB |
1_06.txt | AC | 220 ms | 51704 KB |
1_07.txt | AC | 257 ms | 52600 KB |
1_08.txt | AC | 450 ms | 71928 KB |
1_09.txt | AC | 440 ms | 71160 KB |
1_10.txt | AC | 375 ms | 64632 KB |
1_11.txt | AC | 448 ms | 71416 KB |
1_12.txt | AC | 297 ms | 57464 KB |
1_13.txt | AC | 389 ms | 64632 KB |
1_14.txt | AC | 454 ms | 71428 KB |
1_15.txt | AC | 453 ms | 71544 KB |
1_16.txt | AC | 440 ms | 69496 KB |
1_17.txt | AC | 439 ms | 69624 KB |
1_18.txt | AC | 436 ms | 69368 KB |
1_19.txt | AC | 451 ms | 70264 KB |
1_20.txt | AC | 433 ms | 69152 KB |
1_21.txt | AC | 438 ms | 69752 KB |
1_22.txt | AC | 437 ms | 69368 KB |
1_23.txt | AC | 437 ms | 69368 KB |