Submission

Status:

PPPPPPPPPTPPPPPPPPPP

Subtask/Task Score:

95/100

Score: 95

User: punzacp555

Problemset: สุ่มสลับ

Language: cpp

Time: 0.197 second

Submitted On: 2026-09-29 22:36:46

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

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

    char s[n], inp[n];
    cin >> inp;

    iota(s, s+n, 'A');

    int cnt = 1;
    do {
        int check = 0;
        for(int i=0; i<n; i++) {
            if(s[i] == inp[i]) check++;
        }
        if(check == n) {cout << cnt; break;}
        cnt++;
    }while(next_permutation(s, s+n));

    return 0;
}