CODE FESTIVAL 2016 qual C

Submission #1691058

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll i,j,k;
    ll l,n,m;
    ll x,y,z;
    ll h,w;
    ll ans;
    cin>>n;
    ll t[n],a[n];
    for(i=0;i<n;i++)cin>>t[i];
    for(i=0;i<n;i++)cin>>a[i];
    ans=1;
    for(i=1;i<n-1;i++){
        if(t[i-1]==t[i]&&a[i+1]==a[i]){
            ans=(ans*min(t[i],a[i]))%1000000007;
            //cout<<ans<<',';
        }
    }
    for(i=1;i<n;i++)if(t[i]!=t[i-1])if(t[i]>a[i]){ans=0;break;}
    for(i=n-2;i>=0;i--)if(a[i]!=a[i+1])if(a[i]>t[i]){ans=0;break;}
    if(a[0]!=t[n-1])ans=0;
    cout<<ans<<endl;


	return 0;
}

Submission

Task問題 C - 二人のアルピニスト / Two Alpinists
User nameユーザ名 YY
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 400
Source lengthソースコード長 733 Byte
File nameファイル名
Exec time実行時間 22 ms
Memory usageメモリ使用量 1792 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_000.txt,0_001.txt,0_002.txt,0_003.txt
All 400 / 400 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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 22 ms 1792 KB
1_009.txt AC 19 ms 1792 KB
1_010.txt AC 20 ms 1792 KB
1_011.txt AC 21 ms 1792 KB
1_012.txt AC 21 ms 1792 KB
1_013.txt AC 21 ms 1792 KB
1_014.txt AC 21 ms 1792 KB
1_015.txt AC 21 ms 1792 KB
1_016.txt AC 20 ms 1792 KB
1_017.txt AC 20 ms 1792 KB
1_018.txt AC 20 ms 1792 KB
1_019.txt AC 18 ms 1792 KB
1_020.txt AC 18 ms 1792 KB