Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Folk_DIWA

Problemset: สุ่มสลับ

Language: cpp

Time: 0.196 second

Submitted On: 2026-03-06 21:10:40

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

int main(){
    cin.tie(nullptr)->sync_with_stdio(0);

    int n; cin >> n;
    string str; cin >> str;
    string base = str;

    sort(str.begin(), str.end());

    vector <string> ans;
    
    long long pos = 0;

    do{
        pos++;
        if(str == base){
            cout << pos;
            break;
        }
    }
    while (next_permutation(str.begin(), str.end()));

}