Submission #60292643


Source Code Expand

#include<bits/stdc++.h>
#include"atcoder/all"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll inf=1ll<<61;
typedef modint1000000007 mi;

ll a[200005];

int main(){
	int n;cin>>n;
	ll sum=0;
	rep(i,n){
		cin>>a[i+1];
		sum+=a[i+1];
		a[n+i+1]=a[i+1];
	}
	rep(i,n+n)a[i+1]+=a[i];
	if(sum%10)cout<<"No"<<endl;
	else{
		rep(i,n){
			ll x=*(lower_bound(a,a+2*n+1,a[i]+sum/10));
			if(x==a[i]+sum/10){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		cout<<"No"<<endl;
	}
}

Submission Info

Submission Time
Task 076 - Cake Cut(★3)
User Rho17
Language C++ 20 (gcc 12.2)
Score 3
Code Size 674 Byte
Status AC
Exec Time 27 ms
Memory 5152 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 3 / 3
Status
AC × 4
AC × 29
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 3620 KiB
hand_02.txt AC 27 ms 5064 KiB
hand_03.txt AC 1 ms 3532 KiB
hand_04.txt AC 10 ms 5036 KiB
hand_05.txt AC 1 ms 3704 KiB
random_01.txt AC 25 ms 5152 KiB
random_02.txt AC 3 ms 3684 KiB
random_03.txt AC 2 ms 3776 KiB
random_04.txt AC 9 ms 3936 KiB
random_05.txt AC 13 ms 4248 KiB
random_06.txt AC 22 ms 4832 KiB
random_07.txt AC 24 ms 5056 KiB
random_08.txt AC 11 ms 4024 KiB
random_09.txt AC 13 ms 4324 KiB
random_10.txt AC 2 ms 3624 KiB
random_11.txt AC 19 ms 4764 KiB
random_12.txt AC 9 ms 3912 KiB
random_13.txt AC 24 ms 4884 KiB
random_14.txt AC 14 ms 4232 KiB
random_15.txt AC 9 ms 4012 KiB
random_16.txt AC 7 ms 3968 KiB
random_17.txt AC 6 ms 3764 KiB
random_18.txt AC 12 ms 4328 KiB
random_19.txt AC 12 ms 4072 KiB
random_20.txt AC 14 ms 4276 KiB
sample_01.txt AC 1 ms 3704 KiB
sample_02.txt AC 1 ms 3524 KiB
sample_03.txt AC 1 ms 3472 KiB
sample_04.txt AC 1 ms 3552 KiB