답안 #583242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583242 2022-06-25T06:34:26 Z AGE Zapina (COCI20_zapina) C++14
22 / 110
1000 ms 104440 KB
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long

using namespace std;
const int N=1e6,M=2e3,mod=1e9+7;
int cnt=0,n,vis[10],viss[10];
set<vector<int>>st;
void bt(int index)
{

    if(index==n)
    {
        for(int j=0;j<=n;j++)
            viss[j]=0;

        for(int j=0;j<n;j++)
            viss[vis[j]]++;

        int ok=0;
        for(int j=1;j<=n;j++){
            if(viss[j]==j)
                ok=1;
        }

        vector<int>v;
        for(int j=0;j<n;j++)
            v.pb(vis[j]);

        if(ok==1)
            st.insert(v);




        return ;

    }

    for(int i=1; i<=n; i++)
    {
        vis[index]=i;
        bt(index+1);
    }
}
main()
{

    cin>>n;

    bt(0);
    cout<<st.size()<<endl;
    return 0;
}

Compilation message

zapina.cpp:48:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   48 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 18 ms 3492 KB Output is correct
5 Correct 452 ms 57096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 18 ms 3492 KB Output is correct
5 Correct 452 ms 57096 KB Output is correct
6 Execution timed out 1093 ms 104440 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 18 ms 3492 KB Output is correct
5 Correct 452 ms 57096 KB Output is correct
6 Execution timed out 1093 ms 104440 KB Time limit exceeded
7 Halted 0 ms 0 KB -