제출 #1117710

#제출 시각아이디문제언어결과실행 시간메모리
1117710vjudge1캥거루 (CEOI16_kangaroo)C++17
0 / 100
2055 ms35252 KiB
#include <bits/stdc++.h> using namespace std; int main(){ freopen("kangaroo.in","r",stdin); freopen("kangaroo.out", "w",stdout); int n,st,ft; cin >> n >> st >> ft; vector<int> sira; for(int i=1;i<=n;++i)sira.push_back(i); int cnt=0; do{ if(sira[0] != st || sira[n-1] != ft)continue; bool flag; flag = (sira[0] < sira[1]); bool val = 1; for(int i=2;i<n;++i){ if(flag ^ (sira[i-1] < sira[i])){ flag ^= 1; continue; } val = 0; continue; } cnt += val; }while(next_permutation(sira.begin(),sira.end())); cout << cnt; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:5:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     freopen("kangaroo.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen("kangaroo.out", "w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...