Submission #1697225
Source Code Expand
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define lb(x) ((x)&(-(x)))
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 1000010
using namespace std;
typedef long long ll;
int n,a[N],r[N];
bool t[N];
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
if(a[i]>a[i-1])t[i]=1,r[i]=a[i];else r[i]=a[i];
}
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=n;i;i--){
if(a[i]>a[i+1]){
if(t[i]&&r[i]!=a[i])return puts("0");
else if(!t[i])t[i]=1,r[i]=a[i];
}else if(t[i]&&r[i]>a[i])return puts("0"),0;
else if(!t[i])r[i]=min(r[i],a[i]);
}
int ans=1;
for(int i=1;i<=n;i++)if(!t[i])ans=1ll*ans*r[i]%dalao;
printf("%d",ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Two Alpinists |
User |
cdsfcesf |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
874 Byte |
Status |
RE |
Exec Time |
26 ms |
Memory |
2816 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:18:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:20:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a[i]);
^
./Main.cpp:23:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
^
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 |
2 ms |
2304 KB |
0_001.txt |
AC |
1 ms |
2304 KB |
0_002.txt |
AC |
2 ms |
2304 KB |
0_003.txt |
AC |
2 ms |
2304 KB |
1_004.txt |
RE |
1 ms |
2304 KB |
1_005.txt |
AC |
2 ms |
2304 KB |
1_006.txt |
AC |
2 ms |
2304 KB |
1_007.txt |
AC |
2 ms |
2304 KB |
1_008.txt |
AC |
26 ms |
2688 KB |
1_009.txt |
AC |
23 ms |
2816 KB |
1_010.txt |
AC |
24 ms |
2816 KB |
1_011.txt |
AC |
25 ms |
2816 KB |
1_012.txt |
RE |
24 ms |
2816 KB |
1_013.txt |
AC |
25 ms |
2816 KB |
1_014.txt |
AC |
24 ms |
2816 KB |
1_015.txt |
AC |
25 ms |
2688 KB |
1_016.txt |
AC |
24 ms |
2816 KB |
1_017.txt |
AC |
24 ms |
2688 KB |
1_018.txt |
AC |
23 ms |
2688 KB |
1_019.txt |
AC |
22 ms |
2688 KB |
1_020.txt |
AC |
20 ms |
2688 KB |