제출 #1005044

#제출 시각아이디문제언어결과실행 시간메모리
1005044SulA캥거루 (CEOI16_kangaroo)C++17
6 / 100
2065 ms348 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n,cs,cf; cin >> n >> cs >> cf; vector<int> p; for (int i = 1; i <= n; i++) { p.push_back(i); } long long cnt = 0; do { bool isGood = p.front() == cs && p.back() == cf; if (!isGood) continue; for (int i = 1; i < n-1; i++) { isGood &= p[i+1] > p[i] != p[i] > p[i-1]; } cnt += isGood; } while (next_permutation(p.begin(), p.end())); cout << cnt; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:20:30: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
   20 |             isGood &= p[i+1] > p[i] != p[i] > p[i-1];
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...