結果

問題 No.550 夏休みの思い出(1)
ユーザー kuuso1kuuso1
提出日時 2017-08-04 00:44:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 2,206 bytes
コンパイル時間 3,781 ms
コンパイル使用メモリ 109,428 KB
実行使用メモリ 26,592 KB
最終ジャッジ日時 2023-08-02 01:09:16
合計ジャッジ時間 8,921 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
24,412 KB
testcase_01 AC 63 ms
22,564 KB
testcase_02 AC 64 ms
22,504 KB
testcase_03 AC 63 ms
22,588 KB
testcase_04 AC 62 ms
20,408 KB
testcase_05 AC 63 ms
22,572 KB
testcase_06 AC 63 ms
22,440 KB
testcase_07 AC 64 ms
22,648 KB
testcase_08 AC 64 ms
24,472 KB
testcase_09 AC 63 ms
22,540 KB
testcase_10 AC 63 ms
20,324 KB
testcase_11 AC 64 ms
20,516 KB
testcase_12 AC 66 ms
22,564 KB
testcase_13 AC 63 ms
22,436 KB
testcase_14 AC 65 ms
22,448 KB
testcase_15 AC 65 ms
24,612 KB
testcase_16 AC 63 ms
22,576 KB
testcase_17 AC 63 ms
22,516 KB
testcase_18 AC 63 ms
22,512 KB
testcase_19 AC 65 ms
22,444 KB
testcase_20 AC 63 ms
24,544 KB
testcase_21 AC 65 ms
22,440 KB
testcase_22 AC 65 ms
22,528 KB
testcase_23 AC 65 ms
22,536 KB
testcase_24 AC 64 ms
22,472 KB
testcase_25 AC 64 ms
22,432 KB
testcase_26 AC 65 ms
20,464 KB
testcase_27 AC 64 ms
24,552 KB
testcase_28 AC 63 ms
22,360 KB
testcase_29 AC 62 ms
22,428 KB
testcase_30 AC 65 ms
22,504 KB
testcase_31 AC 64 ms
20,408 KB
testcase_32 AC 64 ms
22,432 KB
testcase_33 AC 64 ms
22,732 KB
testcase_34 AC 63 ms
22,524 KB
testcase_35 AC 63 ms
22,556 KB
testcase_36 AC 63 ms
22,620 KB
testcase_37 AC 67 ms
24,552 KB
testcase_38 AC 64 ms
22,628 KB
testcase_39 AC 65 ms
22,620 KB
testcase_40 AC 64 ms
22,512 KB
testcase_41 AC 64 ms
22,460 KB
testcase_42 AC 63 ms
22,444 KB
testcase_43 AC 62 ms
22,560 KB
testcase_44 AC 64 ms
24,560 KB
testcase_45 AC 64 ms
22,636 KB
testcase_46 AC 63 ms
22,444 KB
testcase_47 AC 63 ms
26,592 KB
testcase_48 AC 63 ms
22,720 KB
testcase_49 AC 62 ms
20,336 KB
testcase_50 AC 61 ms
24,548 KB
testcase_51 AC 62 ms
22,776 KB
testcase_52 AC 61 ms
22,452 KB
testcase_53 AC 64 ms
22,384 KB
testcase_54 AC 62 ms
22,452 KB
testcase_55 AC 62 ms
22,456 KB
testcase_56 AC 65 ms
22,440 KB
testcase_57 AC 64 ms
24,548 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Func<double,double,double,List<double>> solve2 = (a, b, c) =>{
			var ret = new List<double>(){
				(-b - Math.Sqrt(b * b - 4 * a * c)) / (2 * a),
				(-b + Math.Sqrt(b * b - 4 * a * c)) / (2 * a),
			};
			ret.Sort();
			return ret;
		};
		
		Func<double, double> f = x => x*x*x + (double) A * x * x + (double) B * x + (double) C;
		Func<double, double> nf = x => -f(x);
		Func<long, long> fl = x => x*x*x +  A * x * x + B * x + C;
		
		var ps = solve2(3, 2*(double)A, (double) B);
		Func<Func<double,double>,double,double,double> bins = (g, l, r) =>{
			double Eps = 1e-9;
			for(int t=0;t<100;t++){
				double c = (l + r) / 2.0;
				if(g(c) < -Eps){
					l = c;
				} else {
					r = c;
				}
			}
			return (l + r) / 2.0;
		};
		
		Func<double,List<long>> lins = t =>{
			var ret = new List<long>();
			for(long x = (long) t - 200; x < (long) t + 200;x++){
				if(fl(x) == 0) ret.Add(x);
			}
			return ret;
		};
		
		List<double> candi = new List<double>(){
			bins(f, -1.1e9, ps[0]),
			bins(nf, ps[0], ps[1]),
			bins(f, ps[1], 1.1e9),
		};
		
		HashSet<long> H = new HashSet<long>();
		foreach(var xx in candi){
			var xls = lins(xx);
			foreach(var xl in xls) H.Add(xl);
		}
		
		var ans = H.ToList();
		ans.Sort();
		Console.WriteLine(String.Join(" ",ans));
	}
	long A,B,C;
	public Sol(){
		var d = rla();
		A = d[0]; B = d[1]; C = d[2];
	}

	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(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0