Submission #1455562
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> #define ll long long #define MOD 1000000007 using namespace std; ll N; vector<ll> T; vector<ll> A; ll to[100001]={0}; int main(){ ll inp; ll maxT ,maxA; ll result=0; T.push_back(0); A.push_back(0);//0潰し cin >> N; for(ll i = 0 ;i<N;i++){ cin >> inp; T.push_back(inp); } for(ll i =0;i<N;i++){ cin >> inp; A.push_back(inp); } if(T[N]!=A[1]) { cout << "0" << endl; return 0; } for(ll i = 2;i<=N;i++){ if(T[i]!=T[i-1]){ to[i] = 1; } if(A[N+1-i]!=A[N+2-i]){ if((to[N+1-i]!= 0)&&(to[N+1-i] != 1)){ cout << "0" << endl; return 0; } else{ to[N-i+1] = 1; } } } to[1]=1; to[N] = 1; for(ll i = 1;i<=N;i++){ if(to[i] == 0){ to[i] = T[i]; } } for(ll i = 1;i<=N;i++){ if((to[i] == 0)||(to[i]>A[i])) to[i] = A[i]; } result = 1; for(ll i=1;i<=N;i++){ result*=to[i]; result %= MOD; } cout << result << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Two Alpinists |
User | ukohank517 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1126 Byte |
Status | WA |
Exec Time | 87 ms |
Memory | 2676 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 | WA | 1 ms | 256 KB |
1_006.txt | WA | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 87 ms | 2676 KB |
1_009.txt | AC | 72 ms | 2676 KB |
1_010.txt | AC | 78 ms | 2676 KB |
1_011.txt | AC | 81 ms | 2676 KB |
1_012.txt | WA | 79 ms | 2676 KB |
1_013.txt | AC | 80 ms | 2676 KB |
1_014.txt | WA | 81 ms | 2676 KB |
1_015.txt | AC | 81 ms | 2676 KB |
1_016.txt | WA | 78 ms | 2676 KB |
1_017.txt | AC | 75 ms | 2676 KB |
1_018.txt | WA | 83 ms | 2676 KB |
1_019.txt | AC | 64 ms | 2676 KB |
1_020.txt | WA | 61 ms | 2676 KB |