Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Nitro_Legacy

Problemset: สุ่มสลับ

Language: cpp

Time: 0.199 second

Submitted On: 2026-09-29 13:27:34

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n; 
    string comp;
    cin >> comp;
    string s = "";
    for (int i = 0; i < n; i++){
        s += char(65 + i);
    }
    ll cnt = 1;
    do {
        if (s == comp){
            cout << cnt;
            break;
        }
        cnt++;
    } while(next_permutation(s.begin(), s.end()));
    return 0;
}