# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227335 | dextro | 동전 게임 (KOI15_coin) | C++14 | 29 ms | 768 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int K,C;
int ispossible(int n, int m, int round, int who)
{
if(round==0)
return 1;
if(who==1){
if(round!=C && m+C-round<n)
return 0;
return ispossible(n,m,round,0) || ispossible(n,m-1,round,0);
}
else{
if(n+C-round<m)
return 0;
return ispossible(n,m,round-1,1) || ispossible(n-1,m,round-1,1);
}
}
int main()
{
scanf("%d %d",&K,&C);
int n,m;
for(int i=0; i<C; i++){
scanf("%d %d",&n,&m);
printf("%d\n",ispossible(n,m,C,1));
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |