답안 #893691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893691 2023-12-27T09:35:11 Z vjudge1 캥거루 (CEOI16_kangaroo) C++17
6 / 100
2000 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define ull unsigned long long
#define ld long double
#define lv v+v
#define rv v+v+1
#define files freopen("expert.in", "r", stdin), freopen("expert.out", "w", stdout)
using namespace std;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 10;
const ll P = 337ll;
const ld EPS = 1e-9;
const ll block = 450;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll n;
cin>>n;
ll cs,cf;
cin>>cs;
cin>>cf;
vector <ll> v;
for(ll i = 1; i<=n; i++) {
    v.pb(i);
}
ll ans=0;
do {
    vector <ll> check;
    if(v[0] != cs) {
        continue;
    }
    if(v[n-1] != cf) {
        continue;
    }
    for(ll i = 1; i<n; i++) {
        check.pb(v[i] > v[i-1]);
    }
    bool ok = true;
    for(ll i = 1; i<check.size(); i++) {
        ok&=(check[i] != check[i-1]);
    }
    if(ok) {
        ans++;
    }
}
while(next_permutation(all(v)));
cout<<ans;
return 0;
}
// equal, min, max, 1, random, build
/*

*/

Compilation message

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:45:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(ll i = 1; i<check.size(); i++) {
      |                   ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2055 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2055 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2055 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -