結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー | crimsontea |
提出日時 | 2023-10-20 22:46:13 |
言語 | C# (.NET 8.0.203) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,622 bytes |
コンパイル時間 | 14,924 ms |
コンパイル使用メモリ | 167,036 KB |
実行使用メモリ | 205,784 KB |
最終ジャッジ日時 | 2024-09-20 20:45:23 |
合計ジャッジ時間 | 113,888 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,938 ms
203,684 KB |
testcase_01 | AC | 1,893 ms
203,248 KB |
testcase_02 | AC | 1,985 ms
203,816 KB |
testcase_03 | AC | 1,947 ms
203,808 KB |
testcase_04 | AC | 1,929 ms
203,684 KB |
testcase_05 | AC | 1,936 ms
203,288 KB |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | AC | 1,952 ms
203,532 KB |
testcase_16 | AC | 1,990 ms
203,404 KB |
testcase_17 | AC | 1,959 ms
203,936 KB |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | AC | 2,018 ms
203,944 KB |
testcase_21 | AC | 1,950 ms
203,560 KB |
testcase_22 | AC | 2,008 ms
205,784 KB |
testcase_23 | AC | 2,043 ms
203,556 KB |
testcase_24 | AC | 1,996 ms
203,536 KB |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | AC | 1,978 ms
203,932 KB |
testcase_28 | TLE | - |
testcase_29 | AC | 2,041 ms
203,676 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (89 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
#nullable enable using System; using System.Linq; using System.Collections; using System.IO; using System.Collections.Generic; using System.Text; using System.Numerics; using System.Runtime.Intrinsics.X86; using System.Buffers; using System.Diagnostics; using System.Runtime.CompilerServices; using static InputUtility; using System.Reflection; class Program { static void Main() { InputNewLine(); var x = NextInt32; var abc = Abc(); static (int v, int c)[] Abc() { List<(int v, int c)> abc = new(); for (int a = 0; a <= 300; a++) { for (int b = a; b <= 300; b++) { for (int c = b; c <= 300; c++) { abc.Add((a * a * a + b * b * b + c * c * c, c)); } } } return abc.ToArray(); } Array.Sort(abc); var def = Def(); static (int v, int d)[] Def() { List<(int v, int d)> def = new(); for (int a = 0; a <= 300; a++) { for (int b = a; b <= 300; b++) { for (int c = b; c <= 300; c++) { def.Add((a * a * a + b * b * b + c * c * c, a)); } } } return def.ToArray(); } Array.Sort(def); Array.Sort(def); int res = 0; int left = def.Length - 1; foreach (var (v, c) in abc) { var target = x - v; if (target < 0) { break; } while (left >= 0 && target <= def[left].v) { left--; } left++; if (target != def[left].v) { continue; } for (int i = left; i < def.Length; i++) { if (target < def[i].v) { break; } if (c <= def[i].d) { res++; } } } Console.WriteLine(res); } } public static class InputUtility { private static string[]? s_inputs; private static string? s_raw; private static int s_index = 0; private static void Init() => s_index = 0; public static int NextInt32 => int.Parse(s_inputs![s_index++]!); public static uint NextUInt32 => uint.Parse(s_inputs![s_index++]!); public static long NextInt64 => long.Parse(s_inputs![s_index++]!); public static string NextString => s_inputs![s_index++]; public static char NextChar => s_inputs![s_index++][0]; public static int[] GetInt32Array() => s_inputs!.Select(int.Parse).ToArray(); public static long[] GetInt64Array() => s_inputs!.Select(long.Parse).ToArray(); public static string GetRawString() => s_raw!; #if DEBUG private static TextReader? s_textReader; public static void SetSource(string path) => s_textReader = new StringReader(File.ReadAllText(path)); #endif public static bool InputNewLine() { #if DEBUG if (s_textReader is TextReader sr) { Init(); s_raw = sr.ReadLine()!; s_inputs = s_raw.Split(' ', StringSplitOptions.RemoveEmptyEntries); return true; } #endif Init(); s_raw = Console.ReadLine()!; s_inputs = s_raw.Split(' ', StringSplitOptions.RemoveEmptyEntries); return true; } }