Submission #1317466
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int DIM = 1e5 + 5; const int MOD = 1e9 + 7; int t[DIM], a[DIM], h[DIM]; int main( void ) { int n; cin >> n; for( int i = 1; i <= n; i ++ ) cin >> t[i]; for( int i = 1; i <= n; i ++ ) cin >> a[i]; for( int i = 1; i <= n; i ++ ) { if( t[i] != t[i - 1] ) { if( h[i] == 0 ) h[i] = t[i]; else if( h[i] != t[i] ) { cout << 0 << endl; return 0; } } } for( int i = n; i >= 1; i -- ) { if( a[i] != a[i + 1] ) { if( h[i] == 0 ) h[i] = a[i]; else if( h[i] != a[i] ) { cout << 0 << endl; return 0; } } } int ans = 1; for( int i = 1; i <= n; i ++ ) { if( h[i] == 0 ) ans = ( 1LL * ans * min( t[i], a[i] ) ) % MOD; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | EmanuelNrx |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1082 Byte |
Status | WA |
Exec Time | 114 ms |
Memory | 1408 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 | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
0_003.txt | AC | 1 ms | 256 KB |
1_004.txt | AC | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | WA | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 114 ms | 1024 KB |
1_009.txt | AC | 93 ms | 1408 KB |
1_010.txt | AC | 99 ms | 1280 KB |
1_011.txt | AC | 106 ms | 1280 KB |
1_012.txt | AC | 101 ms | 1408 KB |
1_013.txt | AC | 105 ms | 1280 KB |
1_014.txt | AC | 104 ms | 1408 KB |
1_015.txt | AC | 106 ms | 1152 KB |
1_016.txt | AC | 101 ms | 1408 KB |
1_017.txt | AC | 98 ms | 1024 KB |
1_018.txt | WA | 94 ms | 1152 KB |
1_019.txt | AC | 82 ms | 1024 KB |
1_020.txt | WA | 76 ms | 1024 KB |