Submission #22374

# Submission time Handle Problem Language Result Execution time Memory
22374 2017-04-30T04:17:09 Z dried chocochip on Daegu asphalt(#897, suzy, zych1751, Acka) Unifying Values (KRIII5_UV) C++
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <unordered_map>

using namespace std;

#define MOD 1000000007

typedef long long lli;

unordered_map<lli,int> d[10000];
lli a[10000];
int n;

int main() {
	scanf("%d",&n);
	lli s=0;
	for(int i=0;i<n;i++) {
		scanf("%lld",&a[i]);
		s+=a[i];
		d[i][s]=1;
	}
	for(int i=1;i<n;i++) {
		lli sum=0;
		for(int j=i;j<n;j++) {
			sum+=a[j];
			if(d[i-1].count(sum)) d[j][sum]+=d[i-1][sum];
			if(d[j][sum]>=MOD) d[j][sum]-=MOD;
		}
	}
	int res=0;
	for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
		res+=it->second;
		if(res>=MOD) res-=MOD;
	}
	printf("%d\n",--res);
	return 0;
}

Compilation message

In file included from /usr/include/c++/5/unordered_map:35:0,
                 from UV.cpp:2:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
UV.cpp:10:1: error: 'unordered_map' does not name a type
 unordered_map<lli,int> d[10000];
 ^
UV.cpp: In function 'int main()':
UV.cpp:20:3: error: 'd' was not declared in this scope
   d[i][s]=1;
   ^
UV.cpp:26:7: error: 'd' was not declared in this scope
    if(d[i-1].count(sum)) d[j][sum]+=d[i-1][sum];
       ^
UV.cpp:27:7: error: 'd' was not declared in this scope
    if(d[j][sum]>=MOD) d[j][sum]-=MOD;
       ^
UV.cpp:31:6: error: 'unordered_map' was not declared in this scope
  for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
      ^
UV.cpp:31:23: error: expected primary-expression before ',' token
  for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
                       ^
UV.cpp:31:24: error: expected primary-expression before 'int'
  for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
                        ^
UV.cpp:31:57: error: 'it' was not declared in this scope
  for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
                                                         ^
UV.cpp:31:61: error: 'd' was not declared in this scope
  for(unordered_map<lli,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) {
                                                             ^
UV.cpp:15:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
UV.cpp:18:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
                      ^