Submission

Status:

PPPPPPPTPTPPPPPPPTPP

Subtask/Task Score:

85/100

Score: 85

User: mocngaijakraila

Problemset: สุ่มสลับ

Language: cpp

Time: 0.194 second

Submitted On: 2026-07-21 23:03:55

#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
int l; 
vector<char> c;


int main() {
    cin.tie(0)->sync_with_stdio(0);
    
    string t = " ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string targ;
    int cnt = 1;
    cin >> l >> targ;
    for(int i = 1; i <= l; i++) {
        c.push_back(t[i]);
    }
    string k = "";
    do{
        for(auto e : c) {
            k += e;    
        }
        if(k == targ) {
            cout << cnt;
            return 0;
        }

        k = "";
        cnt++;
        // cout << '\n';

    }while(next_permutation(all(c)));

    return 0;
}