Submission #405934

#TimeUsernameProblemLanguageResultExecution timeMemory
405934AriaHKangaroo (CEOI16_kangaroo)C++11
6 / 100
2084 ms204 KiB
/** I can do this all day **/ #pragma GCC optimize("O2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define all(x) (x).begin(),(x).end() #define F first #define S second #define Mp make_pair #define SZ(x) (int)x.size() #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_io freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout); const int N = 10; const ll mod = 1e9 + 7; const ll mod2 = 998244353; const ll inf = 8e18; const int LOG = 22; ll pw(ll a , ll b, ll M) { return (!b ? 1 : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M : pw(a * a % M, b / 2, M))); } int n, s, f, seen[N]; ll tot; void calc(int now, int prv) { int full = 1; for(int i = 1; i <= n; i ++) full &= seen[i]; if(full && now == f) { tot ++; if(tot == mod) tot = 0; } if(prv < now) { for(int j = 1; j < now; j ++) { if(seen[j]) continue; seen[j] = 1; calc(j, now); seen[j] = 0; } } else { for(int j = now + 1; j <= n; j ++) { if(seen[j]) continue; seen[j] = 1; calc(j, now); seen[j] = 0; } } } int main() { scanf("%d%d%d", &n, &s, &f); seen[s] = 1; calc(s, 0); calc(s, n + 1); printf("%lld", tot); return 0; } /** test corner cases(n = 1?) watch for overflow or minus indices **/

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:64:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |  scanf("%d%d%d", &n, &s, &f);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...