結果
| 問題 |
No.102 トランプを奪え
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2014-12-15 23:06:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 5,000 ms |
| コード長 | 2,048 bytes |
| コンパイル時間 | 1,217 ms |
| コンパイル使用メモリ | 114,016 KB |
| 実行使用メモリ | 32,584 KB |
| 最終ジャッジ日時 | 2024-06-11 21:26:49 |
| 合計ジャッジ時間 | 2,319 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
Gr=new int[14][][][];
for(int i=0;i<=13;i++){
Gr[i]=new int[14][][];
for(int j=0;j<=13;j++){
Gr[i][j]=new int[14][];
for(int k=0;k<=13;k++){
Gr[i][j][k]=new int[14];
}
}
}
memo=new bool[14][][][];
for(int i=0;i<=13;i++){
memo[i]=new bool[14][][];
for(int j=0;j<=13;j++){
memo[i][j]=new bool[14][];
for(int k=0;k<=13;k++){
memo[i][j][k]=new bool[14];
}
}
}
Gr[0][0][0][0]=0;
memo[0][0][0][0]=true;
for(int i=0;i<=13;i++){
for(int j=0;j<=13;j++){
for(int k=0;k<=13;k++){
for(int l=0;l<=13;l++){
Gr[i][j][k][l]=dfs(i,j,k,l);
}
}
}
}
Console.WriteLine(Gr[A[0]][A[1]][A[2]][A[3]]==0?"Jiro":"Taro");
}
int[][][][] Gr;
bool[][][][] memo;
int dfs(int i,int j,int k,int l){
if(memo[i][j][k][l])return Gr[i][j][k][l];
HashSet<int> H=new HashSet<int>();
for(int t=1;t<=3;t++){
if(i-t>=0)H.Add(dfs(i-t,j,k,l));
if(j-t>=0)H.Add(dfs(i,j-t,k,l));
if(k-t>=0)H.Add(dfs(i,j,k-t,l));
if(l-t>=0)H.Add(dfs(i,j,k,l-t));
}
int g=0;
while(H.Contains(g))g++;
memo[i][j][k][l]=true;
return Gr[i][j][k][l]=g;
}
int[] A;
public Sol(){
A=ria();
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(){return Console.ReadLine().Split(' ');}
static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
kuuso1