Submission #2967687


Source Code Expand

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
vector<string>x;
string s;
int main(void){
    cin>>s;
    for(int i=0;i<s.size();i++){
        string a="";
        a+=s[i];
        x.PB(a);
    }
    while(1){
        string m=x[0];
        for(int i=1;i<x.size();i++){
            m=min(m,x[i]);
        }
        bool o=true;
        for(int i=0;i<x.size();i++)if(x[i]!=m)o=false;
        if(o){
            cout<<"Yes\n";
            return 0;
        }
        if(x[0]!=m){
            cout<<"No\n";
            return 0;
        }
        vector<string> y;
        for(int i=0;i<x.size();i++){
            if(x[i]==m){
                y.PB(x[i]);
            }else y.back()+=x[i];
        }
        x.clear();
        for(int i=0;i<y.size();i++)x.PB(y[i]);
    }
}

Submission Info

Submission Time
Task G - 交換法則
User nxteru
Language C++14 (GCC 5.4.1)
Score 800
Code Size 1133 Byte
Status AC
Exec Time 158 ms
Memory 512 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 800 / 800
Status
AC × 5
AC × 75
Set Name Test Cases
Sample 00_sample_00, 00_sample_01, 00_sample_02, 00_sample_03, 00_sample_04
All 00_sample_00, 00_sample_01, 00_sample_02, 00_sample_03, 00_sample_04, 01_random_00, 01_random_01, 01_random_02, 01_random_03, 01_random_04, 01_random_05, 01_random_06, 01_random_07, 01_random_08, 01_random_09, 02_random_large_00, 02_random_large_01, 02_random_large_02, 02_random_large_03, 02_random_large_04, 02_random_large_05, 02_random_large_06, 02_random_large_07, 02_random_large_08, 02_random_large_09, 03_maximal_00, 03_maximal_01, 03_maximal_02, 03_maximal_03, 03_maximal_04, 04_fibonacci_00, 04_fibonacci_01, 04_fibonacci_02, 04_fibonacci_03, 04_fibonacci_04, 04_fibonacci_05, 04_fibonacci_06, 04_fibonacci_07, 04_fibonacci_08, 04_fibonacci_09, 05_single_00, 05_single_01, 05_single_02, 05_single_03, 05_single_04, 05_single_05, 05_single_06, 05_single_07, 05_single_08, 05_single_09, 06_dividing_00, 06_dividing_01, 06_dividing_02, 06_dividing_03, 06_dividing_04, 06_dividing_05, 06_dividing_06, 06_dividing_07, 06_dividing_08, 06_dividing_09, 97_max_00, 97_max_01, 97_max_02, 97_max_03, 97_max_04, 97_max_05, 98_challenge_00, 98_challenge_01, 98_challenge_02, 99_handmade_00, 99_handmade_01, 99_handmade_02, 99_handmade_03, 99_handmade_04, 99_handmade_05
Case Name Status Exec Time Memory
00_sample_00 AC 1 ms 256 KB
00_sample_01 AC 1 ms 256 KB
00_sample_02 AC 1 ms 256 KB
00_sample_03 AC 1 ms 256 KB
00_sample_04 AC 1 ms 256 KB
01_random_00 AC 1 ms 384 KB
01_random_01 AC 2 ms 384 KB
01_random_02 AC 1 ms 384 KB
01_random_03 AC 2 ms 384 KB
01_random_04 AC 1 ms 256 KB
01_random_05 AC 2 ms 384 KB
01_random_06 AC 1 ms 384 KB
01_random_07 AC 2 ms 384 KB
01_random_08 AC 1 ms 384 KB
01_random_09 AC 1 ms 256 KB
02_random_large_00 AC 2 ms 512 KB
02_random_large_01 AC 2 ms 384 KB
02_random_large_02 AC 2 ms 384 KB
02_random_large_03 AC 2 ms 384 KB
02_random_large_04 AC 2 ms 384 KB
02_random_large_05 AC 2 ms 384 KB
02_random_large_06 AC 2 ms 384 KB
02_random_large_07 AC 2 ms 384 KB
02_random_large_08 AC 2 ms 384 KB
02_random_large_09 AC 2 ms 384 KB
03_maximal_00 AC 2 ms 384 KB
03_maximal_01 AC 2 ms 384 KB
03_maximal_02 AC 2 ms 384 KB
03_maximal_03 AC 2 ms 384 KB
03_maximal_04 AC 2 ms 384 KB
04_fibonacci_00 AC 2 ms 384 KB
04_fibonacci_01 AC 2 ms 384 KB
04_fibonacci_02 AC 2 ms 384 KB
04_fibonacci_03 AC 2 ms 384 KB
04_fibonacci_04 AC 2 ms 384 KB
04_fibonacci_05 AC 2 ms 384 KB
04_fibonacci_06 AC 2 ms 384 KB
04_fibonacci_07 AC 2 ms 384 KB
04_fibonacci_08 AC 2 ms 384 KB
04_fibonacci_09 AC 2 ms 384 KB
05_single_00 AC 2 ms 384 KB
05_single_01 AC 2 ms 384 KB
05_single_02 AC 2 ms 384 KB
05_single_03 AC 2 ms 384 KB
05_single_04 AC 2 ms 384 KB
05_single_05 AC 2 ms 384 KB
05_single_06 AC 2 ms 384 KB
05_single_07 AC 2 ms 384 KB
05_single_08 AC 2 ms 384 KB
05_single_09 AC 2 ms 384 KB
06_dividing_00 AC 2 ms 512 KB
06_dividing_01 AC 2 ms 512 KB
06_dividing_02 AC 2 ms 512 KB
06_dividing_03 AC 2 ms 512 KB
06_dividing_04 AC 2 ms 512 KB
06_dividing_05 AC 2 ms 512 KB
06_dividing_06 AC 2 ms 512 KB
06_dividing_07 AC 2 ms 512 KB
06_dividing_08 AC 2 ms 512 KB
06_dividing_09 AC 2 ms 512 KB
97_max_00 AC 2 ms 384 KB
97_max_01 AC 2 ms 384 KB
97_max_02 AC 2 ms 384 KB
97_max_03 AC 158 ms 512 KB
97_max_04 AC 2 ms 384 KB
97_max_05 AC 2 ms 512 KB
98_challenge_00 AC 1 ms 256 KB
98_challenge_01 AC 1 ms 256 KB
98_challenge_02 AC 1 ms 256 KB
99_handmade_00 AC 1 ms 256 KB
99_handmade_01 AC 1 ms 256 KB
99_handmade_02 AC 1 ms 256 KB
99_handmade_03 AC 1 ms 256 KB
99_handmade_04 AC 1 ms 256 KB
99_handmade_05 AC 1 ms 256 KB