# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1117776 |
2024-11-24T08:17:18 Z |
vjudge1 |
Match (CEOI16_match) |
C++17 |
|
1 ms |
336 KB |
#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 time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |