Submission #22585

# Submission time Handle Problem Language Result Execution time Memory
22585 2017-04-30T05:44:48 Z past future present(#977, kazel, pjh0123, nemo) Unifying Values (KRIII5_UV) C++14
0 / 7
3 ms 2392 KB
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int n;
ll a[10101];
ll sum[101010];
ll ans;
ll p[10101];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        sum[i] = sum[i-1] + a[i];
    }

    for(int i=1;i<n;i++){
        ll x = sum[i];
        if(sum[n]/x*x != sum[n])continue;
        vector<ll> v;
        fill(p,p+n+1,0);
        v.push_back(1);
        for(int j=i+1;j<=n;j++){
            if(sum[j]/x*x == sum[j]){
                ll t = sum[j]/x;
                if(t>1)v.push_back(t);
            }
        }
        p[0]=1;
        for(auto t : v){
            p[t]+=p[t-1];
            p[t]%=mod;
        }
        ans+=p[v.back()];
        ans%=mod;
    }
    printf("%lld\n",ans);
}

Compilation message

UV.cpp: In function 'int main()':
UV.cpp:13:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
UV.cpp:15:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
                            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2120 KB Output is correct
2 Correct 0 ms 2120 KB Output is correct
3 Correct 0 ms 2120 KB Output is correct
4 Correct 3 ms 2392 KB Output is correct
5 Correct 3 ms 2392 KB Output is correct
6 Runtime error 0 ms 2120 KB Execution killed with signal 8 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2120 KB Execution killed with signal 8 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -