Submission

Status:

PPPPPPPxPxPPPPPPPxPP

Subtask/Task Score:

85/100

Score: 85

User: Folk_DIWA

Problemset: สุ่มสลับ

Language: cpp

Time: 0.010 second

Submitted On: 2026-03-06 21:00:06

#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;

    do{
        ans.push_back(str);
        if(ans[ans.size()-1] == base){
            cout << ans.size();
            break;
        }
    }
    while (next_permutation(str.begin(), str.end()));

}