Submission #3265515


Source Code Expand

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
atoz = [chr(i) for i in range(97,97+26)]

S = input()

if len(S) < 26:
    for a in atoz:
        if not a in S:
            print(S+a)
            break
else:
    right = S[-1]
    for i in reversed(range(len(S))):
        s = S[i]
        if s < right:
            print(S[:i]+right)
            sys.exit()
        else:
            right = max(s,right)
    print(-1)

Submission Info

Submission Time
Task A - Diverse Word
User simamumu
Language Python (3.4.3)
Score 0
Code Size 700 Byte
Status WA
Exec Time 30 ms
Memory 4204 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
WA × 1
AC × 15
WA × 8
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt AC 29 ms 4200 KB
02.txt AC 30 ms 4200 KB
03.txt WA 29 ms 4204 KB
04.txt AC 29 ms 4196 KB
05.txt AC 29 ms 4200 KB
06.txt AC 29 ms 4200 KB
07.txt AC 29 ms 4196 KB
08.txt AC 29 ms 4196 KB
09.txt AC 29 ms 4200 KB
10.txt AC 30 ms 4200 KB
11.txt AC 30 ms 4200 KB
12.txt WA 30 ms 4200 KB
13.txt AC 29 ms 4196 KB
14.txt WA 29 ms 4196 KB
15.txt WA 29 ms 4200 KB
16.txt WA 30 ms 4196 KB
17.txt WA 30 ms 4196 KB
18.txt AC 30 ms 4196 KB
19.txt WA 29 ms 4196 KB
s1.txt AC 29 ms 4204 KB
s2.txt AC 29 ms 4196 KB
s3.txt AC 29 ms 4200 KB
s4.txt WA 29 ms 4200 KB