제출 #1117835

#제출 시각아이디문제언어결과실행 시간메모리
1117835vjudge1캥거루 (CEOI16_kangaroo)C++17
0 / 100
1 ms336 KiB
//Desinged by AzeTurk810 Open source
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define ull unsigned long long
# define hurryup ios_base::sync_with_stdio(false);cin.tie();cout.tie()
# define pb push_back
# define int int64_t
int const LIMIT = 1e9;
/*int up=int(1e8) +20;

vector<bool>is_prime2(up,false);
vector<int>sieve (int n)
{
vector<bool>is_prime(up,true);
    vector<int>primes;
    ll k=0;
    primes.pb(2);
    primes.pb(3);
    primes.pb(5);
    is_prime2[2] = is_prime2[3] = is_prime2[5] = true;
    is_prime[0]=is_prime[1]=false;
    is_prime[4]= is_prime[6]=is_prime[10] =false;
    for(ll i=7;i<n;)
    {
        if(is_prime[i])
        {primes.pb(i);is_prime2[i]=true;//if(i<20)cout<<i<<' ';
            for(ll j=(ll)i*i;j<n;j+=i)
            {
                is_prime[j]=false;
            }
        }
        if(k%2==0)
        {
            i+=4;
        }
        else
            i+=2;
        k++;
    }

    return primes;
}*/
/*void solvemax(ll n,vector < int>primes,int up)
{
    ll nc=n;
    ll sum=0,powr=0,sumc=0,powc=0,ans=1;
    int i=0;
    for(int i=0;primes[i]<=n && i<primes.size();i++)
    {
        //cout<<n<<endl;
        if(n<up)
        {
            if(is_prime2[n])
            {
                //cout<<-1<<' ';
                ans*=n+1;
                n=1;
            }
        }
        if(n%primes[i]==0)
        {
            powc=0,powr=1,sum=0;
            while(n%primes[i]==0)
            {
                sum+=powr;
                powr*=primes[i];
                n/=primes[i];
                powc++;
            }
            sum+=powr;
            ans*=sum;
        }
        i++;
    }
    if(n>1)
        ans*=n+1;
    cout<<ans-nc<<endl;
}*/
//vector<int>prm(1e6 + 1,0);
/*void sqrtq(int limit)
{

    //cout<<1<<endl;

    prm[1] = 1;ll last= 2;
    for(ll i=2;i<=limit;i++)
    {
        if(prm[i]==0)
        {
            prm [i] = last;
            last++;
            for(ll j=(ll)i*i;j<=limit;j+=i*i)
            {//return prm;
                prm[j]=-1;
            }
        }
    }
}*/


signed main()
{
    /*hurryup;
    ll t=1,n,m;
    cin>>t;



    vector<int>primes = sieve(up);//cout<<primes.size()<<endl;
    //if(is_prime[10])
        //cout<<10<<endl;
    while(t--)
    {
        cin>>n;
        solvemax(n,primes,up);
    }*/
    int t,n,a,ans = 0,cf,cs;
    cin>>n>>cs>>cf;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        v.pb(i + 1);
    }
    
    do{
        // cout<<v<<endl;
        bool ok = 1;
        if(v[0] == cs  && v[n - 1] == cf )
        {
            for(int i=1;i<n - 1;i++)
            {
                if(v[i] > v[i-1] && v[i] > v[i+ 1])
                {
                    t = 1;
                }
                else if(v[i] < v[i-1] && v[i] < v[i+ 1])
                    t = 1;
                else
                    ok = false;break;
            }
            if(ok){ans++;
                //cout<<"ok"<<endl;1000000007
                
            }
            ans = ans % 1000000007;
        }
    } while(next_permutation(v.begin(),v.end()));
    cout<<ans % 1000000007<<endl;
}

컴파일 시 표준 에러 (stderr) 메시지

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:139:17: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
  139 |                 else
      |                 ^~~~
kangaroo.cpp:140:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
  140 |                     ok = false;break;
      |                                ^~~~~
kangaroo.cpp:118:9: warning: variable 't' set but not used [-Wunused-but-set-variable]
  118 |     int t,n,a,ans = 0,cf,cs;
      |         ^
kangaroo.cpp:118:13: warning: unused variable 'a' [-Wunused-variable]
  118 |     int t,n,a,ans = 0,cf,cs;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...