Submission #2251873
Source Code Expand
#include<iostream> #include<algorithm> #include<set> #define LL long long LL N; LL mod = 1000000000 + 7; LL R[100010]; LL ans = 1; bool D[100010]; int main() { std::cin >> N; LL bef = 0; for (int i = 1; i <= N; i++) { LL tmp; std::cin >> tmp; if (tmp != bef) { D[i] = true; } R[i] = tmp; bef = tmp; } bef = 0; for (int i = 1; i <= N; i++) { LL tmp; std::cin >> tmp; if (bef != tmp) { if (R[i] < tmp) { std::cout << 0 << std::endl; return 0; } if (D[i - 1]) { if (R[i - 1] != bef) { std::cout << 0 << std::endl; return 0; } } D[i - 1] = true; } R[i] = std::min(tmp, R[i]); bef = tmp; } D[N] = true; if (bef != R[N]) { std::cout << 0 << std::endl; return 0; } for (int i = 1; i <= N; i++) { if (!D[i]) { ans *= R[i]; ans %= mod; } } std::cout << ans << std::endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | ikefumy |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 923 Byte |
Status | WA |
Exec Time | 86 ms |
Memory | 1024 KB |
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 | WA | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | WA | 1 ms | 256 KB |
0_003.txt | AC | 1 ms | 256 KB |
1_004.txt | WA | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | AC | 1 ms | 256 KB |
1_007.txt | WA | 1 ms | 256 KB |
1_008.txt | AC | 86 ms | 1024 KB |
1_009.txt | WA | 36 ms | 1024 KB |
1_010.txt | WA | 38 ms | 1024 KB |
1_011.txt | WA | 40 ms | 1024 KB |
1_012.txt | AC | 40 ms | 1024 KB |
1_013.txt | WA | 40 ms | 1024 KB |
1_014.txt | AC | 40 ms | 1024 KB |
1_015.txt | WA | 40 ms | 1024 KB |
1_016.txt | AC | 39 ms | 1024 KB |
1_017.txt | WA | 37 ms | 1024 KB |
1_018.txt | AC | 34 ms | 1024 KB |
1_019.txt | WA | 25 ms | 1024 KB |
1_020.txt | AC | 35 ms | 1024 KB |