(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1117768

#TimeUsernameProblemLanguageResultExecution timeMemory
1117768vjudge1Paprike (COI18_paprike)C++17
0 / 100
12 ms2128 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define FORI(i, n) for(ll i = 0; i < n; i++) #define FOR(i, n) for(ll i = 1; i <= n; i++) typedef vector<ll> vl; typedef set<ll> setl; #define ff first #define ss second #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define db double #define nll cout << "\n" #define nl "\n" #define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); const ll MOD = 1e9 + 7; const int MAX = 200 + 5; ll n, m, k, res; ll dp[MAX][MAX][MAX][2]; ll start, finish; vl path; void dfs(ll v, ll cnt, ll c, vector < ll > used){ if(cnt == n - 1){ if(v == finish) res++; return; } if(c != 1){ for(ll i = v + 1; i <= n; i++){ if(!used[i]){ path.push_back(i); used[i] = 1; dfs(i, cnt + 1, 1, used); path.pop_back(); used[i] = 0; } } } if(c != 0){ for(ll i = v - 1; i >= 1; i--){ if(!used[i]){ path.push_back(i); used[i] = 1; dfs(i, cnt + 1, 0, used); path.pop_back(); used[i] = 0; } } } } void solve(){ cin >> n >> start >> finish; vector < ll > usedd(n + 1, 0); path.push_back(start); usedd[start] = 1; dfs(start, 0, -23, usedd); cout << res; } signed main(){ // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); sync; ll t = 1; // cin >> t; FOR(i, t){ // cout << "Case #" << i << ": "; solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...