提出 #51017518
ソースコード 拡げる
namespace TUPC2023.C
{
public class Program
{
public static TextReader? input = default;
public static TextWriter? output = default;
public static string TestCaseInput = @"
6
4 2 1 5 6 3
";
public static string TestCaseOutput = @"
4096
";
private const int MOD = 998244353;
public static void Run()
{
var line1 = ReadLineInt();
var N = line1[0];
var Ps = ReadLineInt();
long availableLines = (long)N * (N - 1) / 2;
int max = 0;
for (var i = 0; i < Ps.Length; i++)
{
var currentValue = Ps[i];
if (max > currentValue)
{
availableLines -= 1;
}
else
{
max = currentValue;
}
}
Print(PowMod(2, availableLines, MOD));
}
#region Utility
private static U GetOrDefaultValue<T, U>(Dictionary<T, U> dict, T key, U defaultValue)
{
if (dict.TryGetValue(key, out var returnValue))
{
return returnValue;
}
else
{
return defaultValue;
}
}
private static void AddOrSetValue<T, U>(Dictionary<T, U> dict, T key, U value)
{
if (!dict.TryAdd(key, value))
{
dict[key] = value;
}
}
private struct Vector2
{
public int x;
public int y;
public override bool Equals(object? obj)
{
if (obj is Vector2 other)
{
return other.x == this.x && other.y == this.y;
}
return false;
}
public override int GetHashCode()
{
return x ^ y;
}
}
public static long PowMod(long a, long n, int mod)
{
// a^nを計算
long ans = 1l;
long tmp = a;
// わかりやすくfor文の中ですべて処理
for (; ; )
{
// すべての桁を見終わったら終了
if (n < 1l)
{
break;
}
// 最下位bitが1かどうかの判定
if (n % 2l == 1l)
{
ans = (tmp * ans % mod);
}
// tmpの更新
tmp = (tmp * tmp % mod);
// nのbitを一つずらす
n = n >> 1;
}
return ans;
}
#endregion
#region AtCoder Library
private static string[] ReadLine()
{
var line = input?.ReadLine();
return line?.Split(" ") ?? Array.Empty<string>();
}
private static byte[] ReadLineByte()
{
return ReadLine().Select(byte.Parse).ToArray();
}
private static int[] ReadLineInt()
{
return ReadLine().Select(int.Parse).ToArray();
}
private static long[] ReadLineLong()
{
return ReadLine().Select(long.Parse).ToArray();
}
private static void Print(object data)
{
output?.WriteLine(data.ToString());
output?.Flush();
}
private static int ArraySearch<T>(T needle, T[] heystack)
{
if (needle == null) return -1;
for (int i = 0; i < heystack.Length; i++)
{
if (needle.Equals(heystack[i]))
{
return i;
}
}
return -1;
}
#if !TEST
static void Main(string[] args)
{
input = Console.In;
output = Console.Out;
Run();
}
#endif
#endregion
}
}
提出情報
コンパイルエラー
/judge/Main.cs(79,25): warning CS0078: The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity [/judge/Main.csproj]
/judge/Main.cs(86,26): warning CS0078: The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity [/judge/Main.csproj]
/judge/Main.cs(92,26): warning CS0078: The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity [/judge/Main.csproj]
/judge/Main.cs(92,32): warning CS0078: The 'l' suffix is easily confused with the digit '1' -- use 'L' for clarity [/judge/Main.csproj]
/judge/Main.cs(60,24): warning CS0649: Field 'Program.Vector2.x' is never assigned to, and will always have its default value 0 [/judge/Main.csproj]
/judge/Main.cs(61,24): warning CS0649: Field 'Program.Vector2.y' is never assigned to, and will always have its default value 0 [/judge/Main.csproj]
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
0 / 100 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
00_sample_01, 00_sample_02, 00_sample_03 |
| All |
00_sample_01, 00_sample_02, 00_sample_03, 01_small_01, 01_small_02, 01_small_03, 01_small_04, 01_small_05, 02_big_01, 02_big_02, 02_big_03, 02_big_04, 02_big_05, 02_big_06, 02_big_07, 02_big_08, 02_big_09, 02_big_10 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 00_sample_01 |
AC |
56 ms |
26120 KiB |
| 00_sample_02 |
AC |
49 ms |
25840 KiB |
| 00_sample_03 |
AC |
44 ms |
26124 KiB |
| 01_small_01 |
WA |
48 ms |
26496 KiB |
| 01_small_02 |
WA |
56 ms |
25912 KiB |
| 01_small_03 |
WA |
56 ms |
26236 KiB |
| 01_small_04 |
AC |
43 ms |
25944 KiB |
| 01_small_05 |
AC |
52 ms |
26232 KiB |
| 02_big_01 |
WA |
68 ms |
40500 KiB |
| 02_big_02 |
WA |
63 ms |
38156 KiB |
| 02_big_03 |
WA |
57 ms |
35108 KiB |
| 02_big_04 |
WA |
60 ms |
36472 KiB |
| 02_big_05 |
WA |
66 ms |
40932 KiB |
| 02_big_06 |
WA |
61 ms |
40912 KiB |
| 02_big_07 |
WA |
65 ms |
40748 KiB |
| 02_big_08 |
WA |
71 ms |
40828 KiB |
| 02_big_09 |
AC |
63 ms |
40480 KiB |
| 02_big_10 |
AC |
68 ms |
40388 KiB |