Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Zailagend1

Problemset: สุ่มสลับ

Language: cpp

Time: 0.196 second

Submitted On: 2026-06-20 01:20:37

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;
typedef unordered_set<int> usi;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;

template<typename T> void _dbg(T t) { cerr << t; }
template<typename T, typename... Args> void _dbg(T t, Args... args) { cerr << t << ", "; _dbg(args...); }
#ifdef LOCAL
#define debug(...) do { cerr << "[" << #__VA_ARGS__ << "] = ["; _dbg(__VA_ARGS__); cerr << "]" << endl; } while(0)
#else
#define debug(...)
#endif
vector<char> alphabet;
int counter = 0;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for (char c = 'A'; c <= 'Z'; c++) {
        alphabet.push_back(c);
    }
    int n;
    cin >> n;
    if(n<1 || n>12){return 0;}

    string a;
    cin >> a;
    string b = a;
    sort(all(b));
    do{
      counter++;
      if(b == a){
        break;
      }
    }while(next_permutation(all(b)));
    cout << counter;


    

    return 0;
}