結果
| 問題 |
No.102 トランプを奪え
|
| コンテスト | |
| ユーザー |
buko106
|
| 提出日時 | 2014-12-16 00:21:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 2,224 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 77,000 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 21:26:53 |
| 合計ジャッジ時間 | 1,100 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | #define scani(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
main.cpp:84:3: note: in expansion of macro ‘scani’
84 | scani(n1);scani(n2);scani(n3);scani(n4);
| ^~~~~
main.cpp:22:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | #define scani(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
main.cpp:84:13: note: in expansion of macro ‘scani’
84 | scani(n1);scani(n2);scani(n3);scani(n4);
| ^~~~~
main.cpp:22:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | #define scani(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
main.cpp:84:23: note: in expansion of macro ‘scani’
84 | scani(n1);scani(n2);scani(n3);scani(n4);
| ^~~~~
main.cpp:22:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | #define scani(a) scanf("%d",&a)
| ~~~~~^~~~~~~~~
main.cpp:84:33: note: in expansion of macro ‘scani’
84 | scani(n1);scani(n2);scani(n3);scani(n4);
| ^~~~~
ソースコード
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<climits>
#include<algorithm>
#include<vector>
#include<valarray>
#include<string>
#include<set>
#include<map>
#include<stack>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define DREP(i,n) for(int i=n;i>0;i--)
#define Rep(i,m,n) for(int i=m;i<n;i++)
#define scani(a) scanf("%d",&a)
#define scand(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define printi(a) printf("%d",a)
#define prints(s) printf("%s",s)
#define even(n) (((n)+1)%2)
#define odd(n) ((n)%2)
#define sg(x) ((x)?1:0)
#define LF printf("\n")
#define SPACE printf(" ")
#define pb push_back
#define mp make_pair
#define bs binary_search
#define all(a) (a).begin(),(a).end()
#define MOD 100000007
typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<double,double> pdd;
typedef pair<int,int> pii;
const double pi=acos(-1.0);
double rad(double t){return t*pi/180.0;}
bool flag[15][15][15][15];
bool memo[15][15][15][15];
bool solve(int n1,int n2,int n3,int n4){
n1 = max(0,n1);
n2 = max(0,n2);
n3 = max(0,n3);
n4 = max(0,n4);
//printf("solve(%d,%d,%d,%d) called\n",n1,n2,n3,n4);
if(flag[n1][n2][n3][n4])return memo[n1][n2][n3][n4];
if(n1+n2+n3+n4<=3&&sg(n1)+sg(n2)+sg(n3)+sg(n4)==1)return true;
if(n1>0)REP(c1,3){
if(!solve(n1-c1,n2,n3,n4)){
return memo[n1][n2][n3][n4]=flag[n1][n2][n3][n4]=true;
}
}
if(n2>0)REP(c2,3){
if(!solve(n1,n2-c2,n3,n4)){
return memo[n1][n2][n3][n4]=flag[n1][n2][n3][n4]=true;
}
}
if(n3>0)REP(c3,3){
if(!solve(n1,n2,n3-c3,n4)){
return memo[n1][n2][n3][n4]=flag[n1][n2][n3][n4]=true;
}
}
if(n4>0)REP(c4,3){
if(!solve(n1,n2,n3,n4-c4)){
return memo[n1][n2][n3][n4]=flag[n1][n2][n3][n4]=true;
}
}
flag[n1][n2][n3][n4]=true;
return memo[n1][n2][n3][n4]=false;
}
int main(){
int n1,n2,n3,n4;
scani(n1);scani(n2);scani(n3);scani(n4);
if(solve(n1,n2,n3,n4))printf("Taro\n");
else printf("Jiro\n");
return 0;
}
buko106