Submission #1104665

# Submission time Handle Problem Language Result Execution time Memory
1104665 2024-10-24T08:23:47 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(int k){
    if(v.size()==n){
        p++;
        bool u=1;
        for(int i=0;i<n;i++){
            if(v[i]!=a[i+1])u=0;
        }
        if(u){
            cout<<p;
        }
        return;
    }
    if(k-1>0){
        v.pb(k-1);
        fun(k-1);
        v.pop_back();
    }
    v.pb(k);
    fun(k);
    v.pop_back();
    v.pb(k+1);
    fun(k+1);
    v.pop_back();
}
signed main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    fun(1);
}

Compilation message

teams.cpp: In function 'void fun(long long int)':
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){
      |        ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Correct 1 ms 2552 KB Output is correct
3 Correct 1 ms 2412 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 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2384 KB Output is correct
2 Incorrect 1 ms 2384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 2384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 3152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 2640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 3152 KB Time limit exceeded
2 Halted 0 ms 0 KB -