Submission #1474573
Source Code Expand
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> #include <bitset> using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; const int mod = 1e9 + 7; int main() { int N; cin >> N; ll T[N], A[N]; FOR(i,0,N) cin >> T[i]; FOR(i,0,N) cin >> A[i]; if(N==1) { cout << 1 << endl; return 0; } if(N==2) { if(T[1]!=A[0]) { cout << 0 << endl; return 0; } } bool kakutei[N]; FOR(i,0,N) kakutei[i] = false; kakutei[0] = kakutei[N-1] = true; int mxj = 0; FOR(i,1,N-1) { if(T[i]!=T[i-1]) { kakutei[i] = true; mxj = i; } } for(int i = N - 1; i > 0; i--) { if(A[i-1] != A[i]) { if(i - 1 < mxj) { cout << 0 << endl; return 0; } kakutei[i-1] = true; } } ll ans = 1; FOR(i,0,N) { if(kakutei[i]) continue; ans *= min(T[i], A[i]); ans %= mod; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | nenuon |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1183 Byte |
Status | WA |
Exec Time | 85 ms |
Memory | 1920 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 | 85 ms | 1920 KB |
1_009.txt | AC | 70 ms | 1920 KB |
1_010.txt | AC | 75 ms | 1920 KB |
1_011.txt | AC | 79 ms | 1920 KB |
1_012.txt | AC | 77 ms | 1920 KB |
1_013.txt | AC | 82 ms | 1920 KB |
1_014.txt | AC | 78 ms | 1920 KB |
1_015.txt | AC | 79 ms | 1920 KB |
1_016.txt | AC | 76 ms | 1920 KB |
1_017.txt | AC | 73 ms | 1920 KB |
1_018.txt | AC | 71 ms | 1920 KB |
1_019.txt | AC | 62 ms | 1920 KB |
1_020.txt | AC | 62 ms | 1920 KB |