제출 #838954

#제출 시각아이디문제언어결과실행 시간메모리
838954rahidilbayramli캥거루 (CEOI16_kangaroo)C++17
6 / 100
2066 ms300 KiB
#include<bits/stdc++.h> #define ll long long #define ld long double #define vi vector<int> #define vl vector<ll> #define all(v) v.begin(), v.end() #define pb push_back #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; int main() { ll n, cs, cf, i, j, ans = 0, k = 0; cin >> n >> cs >> cf; int v[n+1]; for(i = 1; i <= n; i++) v[i] = i; while(next_permutation(v+1, v+n+1)) { k = 0; if(v[1] == cs && v[n] == cf) { k = 2; for(i = 2; i <= n - 1; i++) { if((v[i] > v[i-1] && v[i] > v[i+1]) || (v[i] < v[i-1] && v[i] < v[i+1])) k++; } if(k == n) ans++; ans %= 1000000007; } } cout << ans << "\n"; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:15:22: warning: unused variable 'j' [-Wunused-variable]
   15 |     ll n, cs, cf, i, j, ans = 0, k = 0;
      |                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...