제출 #410216

#제출 시각아이디문제언어결과실행 시간메모리
410216Blagojce캥거루 (CEOI16_kangaroo)C++11
0 / 100
3 ms332 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define st first #define nd second #define all(v) begin(v), end(v) #define pq priority_queue using namespace std; typedef long long ll; typedef pair<int,int> pii; const ll inf = 1e18; const ll mod = 1e9+7; const int mxn = 2e5; int n, f, s; int p = 0; int g(int a, int b, int pos, int side){ int dir = ((n-(a+b))&1)^p; int ret = 0; if(side == 0){ if(dir == 0){ if(b == 0 && a == 1){ return 0; } fr(ipos, 0, pos){ ret += g(a-1, b, ipos, 0); } } else{ if(b == 0 && a == 1){ return 1; } fr(ipos, pos, a-1){ ret += g(a-1, b, ipos, 0); } fr(ipos, 0, b){ ret += g(a-1, b, ipos, 1); } } } else{ if(dir == 1){ if(a == 0 && b == 1){ return 0; } fr(ipos, pos, b-1){ ret += g(a, b-1, ipos, 1); } } else{ if(a == 0 && b == 1){ return 1; } fr(ipos, 0, pos){ ret += g(a, b-1, ipos, 1); } fr(ipos, 0, a){ ret += g(a, b-1, pos, 0); } } } return ret; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("kangaroo.in", "r",stdin); freopen("kangaroo.out", "w",stdout); cin >> n >> s >> f; if(s > f) swap(s, f); --s, --f; int A = f; int B = n-A-1; int tot = g(A, B, s, 0); p = 1; tot += g(A, B, s, 0); cout<<tot<<endl; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:77:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |  freopen("kangaroo.in", "r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:78:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   78 |  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...