Submission

Status:

PPPPPPPTPTPPPPPPPTPP

Subtask/Task Score:

85/100

Score: 85

User: dy

Problemset: สุ่มสลับ

Language: cpp

Time: 0.195 second

Submitted On: 2026-10-05 15:44:24

#include<bits/stdc++.h>
using namespace std;
int N,M,k=1;
string s,s2="ABCDEFGHIJKL";
vector<int>v;
bool vv[100005];
void show(){
    if(v.size()==N){
        string s1;
        for(auto xx:v)
        s1+=s2[xx];
        if(s1==s){
        cout<<k;
        exit;
        }
        k++;
    }
    for(int i=0;i<N;i++){
        if(!vv[i]){
        vv[i]=1;    
        v.push_back(i);
        show();
        v.pop_back();
        vv[i]=0;
    }
}
}
int main(){
    cin>>N>>s;
    show();
}