Submission #1919182
Source Code Expand
// header {{{ #include <bits/stdc++.h> using namespace std; // {U}{INT,LONG,LLONG}_{MAX,MIN} #define INF INT_MAX/3 #define MOD (1000000007LL) using LL = long long; // }}} int main() { std::ios::sync_with_stdio(false); int n;cin >> n; vector<int> t(n), a(n); for(int i=0;i<n;i++) cin >> t[i]; for(int i=0;i<n;i++) cin >> a[i]; int l; for(l=n-1;l-1>=0;l--){ if(t[l-1] < t[l]) break; } int r; for(r=0;r<n-1;r++){ if(a[r] > a[r+1]) break; } if(r-l < 0){ cout << 0 << endl; return 0; } vector<int> h(n); LL ans = 1; for(int i=0;i<n;i++) h[i] = min(t[i], a[i]); for(int i=1;i<n-1;i++){ if(h[i-1] >= h[i] && h[i] <= h[i+1]){ ans *= h[i]; ans %= MOD; } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | monman53 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 893 Byte |
Status | WA |
Exec Time | 23 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 | WA | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | AC | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 23 ms | 1408 KB |
1_009.txt | AC | 20 ms | 1408 KB |
1_010.txt | AC | 21 ms | 1408 KB |
1_011.txt | AC | 22 ms | 1408 KB |
1_012.txt | AC | 21 ms | 1024 KB |
1_013.txt | AC | 22 ms | 1408 KB |
1_014.txt | AC | 21 ms | 1024 KB |
1_015.txt | AC | 22 ms | 1408 KB |
1_016.txt | AC | 21 ms | 1024 KB |
1_017.txt | AC | 21 ms | 1408 KB |
1_018.txt | AC | 20 ms | 1024 KB |
1_019.txt | AC | 19 ms | 1408 KB |
1_020.txt | AC | 18 ms | 1024 KB |