Submission #25937193


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
ll mod=1000000007;
ll INF=1LL<<60;

int main() {
    string X;
    cin >> X;
    map<char,char> P;//Pで変換した後普通の辞書順
    vector<pair<string,string>> Q;
    for(int i=0;i<26;i++){
        char C=X[i];
        char D='a'+i;
        P[C]=D;
    }
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        string S,T;
        cin >> S;
        T=S;
        for(int j=0;j<S.size();j++){
            char C=S[j];
            T[j]=P[C];
        }
        Q.push_back({T,S});
    }
    sort(Q.begin(),Q.end());
    for(int i=0;i<N;i++){
        cout << Q[i].second << endl;
    }
}

Submission Info

Submission Time
Task C - Neo-lexicographic Ordering
User SeiyaT
Language C++ (GCC 9.2.1)
Score 300
Code Size 697 Byte
Status AC
Exec Time 122 ms
Memory 7460 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   24 |         for(int j=0;j<S.size();j++){
      |                     ~^~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 14
Set Name Test Cases
Sample example_00, example_01
All example_00, example_01, max, special_00, special_01, special_02, test_00, test_01, test_02, test_03, test_04, test_05, test_06, test_07
Case Name Status Exec Time Memory
example_00 AC 7 ms 3540 KiB
example_01 AC 2 ms 3628 KiB
max AC 122 ms 7304 KiB
special_00 AC 116 ms 7340 KiB
special_01 AC 119 ms 7312 KiB
special_02 AC 116 ms 7460 KiB
test_00 AC 117 ms 7344 KiB
test_01 AC 54 ms 5208 KiB
test_02 AC 38 ms 4100 KiB
test_03 AC 50 ms 5232 KiB
test_04 AC 90 ms 7376 KiB
test_05 AC 108 ms 7304 KiB
test_06 AC 38 ms 4212 KiB
test_07 AC 75 ms 5208 KiB