Submission #1696316


Source Code Expand

#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	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];

	vector<int> known(N,-1);
	int last =-1;
	for(int i =0; i < N; i++) {
		if(T[i] > last) known[i] =T[i];
		last =T[i];
	}
	last =-1;
	for(int i =N-1; i >= 0; i--) {
		if(A[i] > last) {
			if(known[i] != -1 && known[i] != A[i]) {
				cout << "0\n";
				return 0;
			}
			known[i] =A[i];
		}
		last =A[i];
	}

	cat ans =1, mod =1000000007;
	for(int i =0; i < N; i++) if(known[i] == -1) ans =(ans*min(T[i],A[i]))%mod;
	if(ans < 0) ans +=mod;
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing

Submission Info

Submission Time
Task C - Two Alpinists
User xellos
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1638 Byte
Status WA
Exec Time 23 ms
Memory 1408 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 18
WA × 3
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 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 1408 KB
1_013.txt AC 21 ms 1408 KB
1_014.txt AC 21 ms 1408 KB
1_015.txt AC 22 ms 1408 KB
1_016.txt AC 21 ms 1408 KB
1_017.txt AC 21 ms 1408 KB
1_018.txt WA 20 ms 1408 KB
1_019.txt AC 19 ms 1408 KB
1_020.txt WA 18 ms 1408 KB