結果

問題 No.1083 余りの余り
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2020-06-20 01:45:13
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,651 bytes
コンパイル時間 2,410 ms
コンパイル使用メモリ 111,272 KB
実行使用メモリ 25,532 KB
最終ジャッジ日時 2023-09-16 16:30:14
合計ジャッジ時間 6,533 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,600 KB
testcase_01 AC 61 ms
21,444 KB
testcase_02 AC 61 ms
23,528 KB
testcase_03 AC 61 ms
23,456 KB
testcase_04 WA -
testcase_05 AC 84 ms
21,592 KB
testcase_06 AC 61 ms
21,560 KB
testcase_07 AC 61 ms
23,592 KB
testcase_08 AC 61 ms
23,516 KB
testcase_09 AC 61 ms
23,524 KB
testcase_10 AC 60 ms
21,600 KB
testcase_11 AC 61 ms
23,620 KB
testcase_12 AC 62 ms
25,532 KB
testcase_13 AC 61 ms
21,432 KB
testcase_14 AC 61 ms
21,472 KB
testcase_15 AC 60 ms
21,456 KB
testcase_16 AC 62 ms
23,536 KB
testcase_17 AC 62 ms
23,468 KB
testcase_18 WA -
testcase_19 AC 79 ms
21,532 KB
testcase_20 AC 61 ms
21,444 KB
testcase_21 AC 60 ms
21,616 KB
testcase_22 AC 61 ms
21,628 KB
testcase_23 AC 163 ms
23,644 KB
testcase_24 AC 165 ms
21,524 KB
testcase_25 AC 134 ms
24,000 KB
testcase_26 AC 164 ms
21,644 KB
testcase_27 AC 62 ms
21,544 KB
testcase_28 WA -
testcase_29 AC 62 ms
23,548 KB
testcase_30 AC 61 ms
21,732 KB
testcase_31 AC 61 ms
21,428 KB
testcase_32 AC 62 ms
21,560 KB
testcase_33 AC 109 ms
21,928 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Security.Cryptography;
//using nint=System.Int32;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.Ia;
		int g=a.Min();
		int ans=s[1]%g;
		var b=new bool[s[0]];
		var h=new bool[1<<s[0]];
		for(int i = 0;i<s[0];i++) {
			b[i]=true;
			Fu(0,s[1]%a[i],1<<i);
			b[i]=false;
		}
		void Fu(int n,int d,int p) {
			if(d<=ans||h[p]){
				return;
			}
			h[p]=true;
			if(d<g||n==s[0]-1){
				ans=Max(ans,d);
				return;
			}
			for(int i = 0;i<s[0];i++) {
				if(!b[i]){
					b[i]=true;
					Fu(n+1,d%a[i],p|(1<<i));
					b[i]=false;
				}
			}
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0