Submission #7150641
Source Code Expand
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;
class MyUtil
{
public static int[] ReadIntArray()
{
return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
}
public static void AssertEquals<T>(
T expected,
T actual,
[CallerLineNumber] int lno = 0
)
where T : IComparable
{
if (expected.CompareTo(actual) != 0)
{
WriteLine($"Assertion Error at line {lno}:");
WriteLine($"\texpected: {expected}");
WriteLine($"\t actual: {actual}");
Environment.Exit(1);
}
}
}
class Program
{
public static void Main()
{
const int M = 1000000007;
int n = int.Parse(ReadLine());
int[] t = ReadIntArray();
int[] a = ReadIntArray();
int curr = 0;
for (int i = 0; i < n; i++)
{
int h = t[i];
if (h > curr)
{
curr = h;
}
else
{
AssertEquals(curr, h);
t[i] *= -1;
}
}
curr = 0;
for (int i = n-1; i >= 0; i--)
{
int h = a[i];
if (h > curr)
{
if (t[i] < 0)
{
t[i] = a[i];
}
else if (t[i] != a[i])
{
WriteLine(0);
return;
}
curr = h;
}
else
{
if (t[i] < 0)
{
t[i] = -Math.Min(-t[i], h);
}
}
}
long ans = 1;
for (int i = 0; i < n; i++)
{
int h = t[i];
if (h < 0)
{
ans = ans * (-h) % M;
}
}
WriteLine(ans);
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Two Alpinists |
| User | unnohideyuki |
| Language | C# (Mono 4.6.2.0) |
| Score | 0 |
| Code Size | 1561 Byte |
| Status | WA |
| Exec Time | 132 ms |
| Memory | 32180 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt |
| All | 0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_000.txt | AC | 24 ms | 13396 KiB |
| 0_001.txt | AC | 23 ms | 11348 KiB |
| 0_002.txt | AC | 23 ms | 11348 KiB |
| 0_003.txt | AC | 23 ms | 11220 KiB |
| 1_004.txt | AC | 23 ms | 11220 KiB |
| 1_005.txt | AC | 23 ms | 11348 KiB |
| 1_006.txt | WA | 24 ms | 11348 KiB |
| 1_007.txt | AC | 24 ms | 13396 KiB |
| 1_008.txt | AC | 132 ms | 32180 KiB |
| 1_009.txt | AC | 115 ms | 31452 KiB |
| 1_010.txt | AC | 121 ms | 29148 KiB |
| 1_011.txt | AC | 124 ms | 27304 KiB |
| 1_012.txt | AC | 121 ms | 29144 KiB |
| 1_013.txt | AC | 129 ms | 31292 KiB |
| 1_014.txt | AC | 122 ms | 27148 KiB |
| 1_015.txt | AC | 125 ms | 29292 KiB |
| 1_016.txt | AC | 122 ms | 31284 KiB |
| 1_017.txt | AC | 121 ms | 30392 KiB |
| 1_018.txt | WA | 119 ms | 30564 KiB |
| 1_019.txt | AC | 111 ms | 31324 KiB |
| 1_020.txt | WA | 108 ms | 30940 KiB |