Submission #2286412


Source Code Expand

Copy
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
map<char,bool> mp;
string a;
char c='.';
string b("abcdefghijklmnopqrstuvwxyz");
string mx("zyxwvutsrqponmlkjihgfedcba");
int main()
{
    cin>>a;
    for (int i=0;i<a.size();i++)
        mp[a[i]]=true;
    for (int i=0;i<26;i++)
        if (!mp[b[i]]) {c=b[i];break;}
    if (c=='.' && a==mx) {cout<<"-1"<<endl;return 0;}
    else if (c!='.') {cout<<a<<c<<endl;return 0;}
    int flag=0;
    for (int i=25;i>0;i--)
    {
        flag=i;
        if (a[i-1]<a[i]) {for (int j=0;j<26;j++) if (a[i-1]==b[j]) {c=b[j+1];break;} break;}
    }
    for (int i=0;i<flag-1;i++)
        cout<<a[i];
    cout<<c<<endl;
    return 0;
}

Submission Info

Submission Time
Task A - Diverse Word
User momo2007
Language C++14 (GCC 5.4.1)
Score 0
Code Size 849 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt, s4.txt
All 0 / 300 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 1 ms 256 KB
02.txt 1 ms 256 KB
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt 1 ms 256 KB
06.txt 1 ms 256 KB
07.txt 1 ms 256 KB
08.txt 1 ms 256 KB
09.txt 1 ms 256 KB
10.txt 1 ms 256 KB
11.txt 1 ms 256 KB
12.txt 1 ms 256 KB
13.txt 1 ms 256 KB
14.txt 1 ms 256 KB
15.txt 1 ms 256 KB
16.txt 1 ms 256 KB
17.txt 1 ms 256 KB
18.txt 1 ms 256 KB
19.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB
s4.txt 1 ms 256 KB