Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: NovemNotes

Problemset: สุ่มสลับ

Language: cpp

Time: 0.192 second

Submitted On: 2025-10-15 14:21:12

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

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin >> n;
    string s;cin >>s;
    string  tmp=s;
    sort(tmp.begin(),tmp.end());
    int ans=1;
    while(true){
        if(tmp==s){
            cout << ans << "\n";
            return 0;
        }
        next_permutation(tmp.begin(),tmp.end());
        ans++;
    }
    return 0;
}