Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Pera

Problemset: สุ่มสลับ

Language: cpp

Time: 0.198 second

Submitted On: 2025-09-05 10:52:37

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

int main() {
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    string s; cin >> s;

    string sorted = s;
    sort(sorted.begin(), sorted.end());
    // cout << "Sorted : " << sorted << '\n';

    int i = 1;

    do {
        // cout << "Permutation " << i << " : " << s << '\n';
        if (s == sorted) {
            cout << i << '\n';
            return 0;
        }
        i++;
    } while (next_permutation(sorted.begin(), sorted.end()));
}