Submission #1117810

#TimeUsernameProblemLanguageResultExecution timeMemory
1117810vjudge1캥거루 (CEOI16_kangaroo)C++17
6 / 100
2075 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define endl '\n' #define pb push_back #define speedyboy ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(x) x.begin() , x.end() #define F first #define S second #define pll pair<ll , ll> #define pss pair<string , string> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; const ll sz = 10 , INF = 1e18 , MOD = 998244353; ll a[sz]; void open(){ freopen("kangaroo.in" , "r" , stdin); freopen("kangaroo.out" , "w" , stdout); } ll i , j , k; void solve(){ ll n , l , r , ans = 0; cin >> n >> l >> r; for(i = 1 ; i <= n ; i++){ a[i] = i; } do{ if(a[1] == l && a[n] == r){ bool ok = true; ll num = (a[1] > a[2] ? -1 : 1); for(i = 2 ; i < n ; i++){ if((num == 1 && a[i + 1] >= a[i]) || (num == -1 && a[i + 1] <= a[i])){ ok = false; break; } num *= -1; } if(ok) ans++; } }while(next_permutation(a + 1 , a + n + 1)); cout << ans << endl; } signed main(){ speedyboy; open; ll t = 1; //cin >> t; while(t--){ solve(); } }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:53:5: warning: statement is a reference, not call, to function 'open' [-Waddress]
   53 |     open;
      |     ^~~~
kangaroo.cpp:53:5: warning: statement has no effect [-Wunused-value]
kangaroo.cpp: In function 'void open()':
kangaroo.cpp:23:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     freopen("kangaroo.in" , "r" , stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:24:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     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...