답안 #1104676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1104676 2024-10-24T08:40:19 Z ezzzay Calvinball championship (CEOI15_teams) C++14
10 / 100
1000 ms 3152 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
const int mod=1e9+7;
int a[N];
vector<int>v;
    int n;
int po[N];
int p=0;
void fun(){
    if(v.size()==n){
        vector<int>tmp=v;
        sort(tmp.begin(),tmp.end());
        bool u=1;
        for(int i=0;i<n-1;i++){
            if(abs(tmp[i]-tmp[i+1])>1){
                u=0;
            }
        }
        p+=u;
        u=1;
        for(int i=1;i<=n;i++){
            if(a[i]!=v[i-1]){
                u=0;
            }
        }
        if(u){
            cout<<p;
        }
        return;
        
    }
    for(int i=1;i<=n;i++){
        v.pb(i);
        fun();
        v.pop_back();
    }
}
signed main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    fun();
}

Compilation message

teams.cpp: In function 'void fun()':
teams.cpp:15:16: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   15 |     if(v.size()==n){
      |        ~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Correct 1 ms 2384 KB Output is correct
4 Correct 1 ms 2384 KB Output is correct
5 Correct 1 ms 2384 KB Output is correct
6 Correct 1 ms 2384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 859 ms 2384 KB Output is correct
2 Incorrect 859 ms 2384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1046 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1050 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1052 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1044 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1054 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 3152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1060 ms 2896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1049 ms 3152 KB Time limit exceeded
2 Halted 0 ms 0 KB -