Submission #1833834


Source Code Expand

#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서

ll a[100002], b[100002], MAX1[100002], MAX2[100002];
int main() {
	int n;
	scanf("%d", &n);
	fup(i, 1, n, 1)scanf("%lld", a + i);
	fup(i, 1, n, 1)scanf("%lld", b + i);
	fup(i, 1, n, 1)
	{
		if (a[i] != a[i - 1])MAX1[i] = -a[i];
		else MAX1[i] = a[i];
	}
	fdn(i, n, 1, 1)
	{
		if (b[i] != b[i + 1])MAX2[i] = -b[i];
		else MAX2[i] = b[i];
	}
	ll ans = 1;
	fup(i, 1, n, 1)
	{
		ll A = MAX1[i], B = MAX2[i];
		if (A < 0 && B < 0)
		{
			if (A != B)
			{
				puts("0");
				return 0;
			}
		}
		else if (A > 0 && B < 0)
		{
			if (A < -B)
			{
				puts("0");
				return 0;
			}
		}
		else if (A < 0 && B > 0)
		{
			if (B < -A)
			{
				puts("0");
				return 0;
			}
		}
		else
			ans = (ans*(min(A, B))) % MOD;
	}
	printf("%lld", ans);
}

Submission Info

Submission Time
Task C - Two Alpinists
User cheetose
Language C++14 (GCC 5.4.1)
Score 400
Code Size 2072 Byte
Status AC
Exec Time 26 ms
Memory 3328 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:48:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:49:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  fup(i, 1, n, 1)scanf("%lld", a + i);
                                     ^
./Main.cpp:50:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  fup(i, 1, n, 1)scanf("%lld", b + i);
                                     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 21
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 AC 1 ms 256 KB
1_007.txt AC 1 ms 256 KB
1_008.txt AC 26 ms 3328 KB
1_009.txt AC 23 ms 3328 KB
1_010.txt AC 24 ms 3328 KB
1_011.txt AC 25 ms 3328 KB
1_012.txt AC 24 ms 3328 KB
1_013.txt AC 25 ms 3328 KB
1_014.txt AC 24 ms 3328 KB
1_015.txt AC 25 ms 3328 KB
1_016.txt AC 24 ms 3328 KB
1_017.txt AC 24 ms 3328 KB
1_018.txt AC 23 ms 3328 KB
1_019.txt AC 22 ms 3328 KB
1_020.txt AC 21 ms 3328 KB