Submission #3791530
Source Code Expand
#include<bits/stdc++.h> using namespace std; using ll = long long; #define int ll; using VI = vector<int>; using VVI =vector<VI>; using PII pair<int,int>; #define FOR(i,a,n) for(ll i = (ll)a; i<(ll)n;++i) #define REP(i,n) FOR(i,0,n) #define ALL(x) x.begin(),x.end() #define PB push_back signed main(void){ cin.tie(); ios::sync_with_stdio(false); int n; cin >> n; VI a(n); REP(i,n) cin >> a[i]; VI b(n); b[0] = a[0]; FOR(i,1,n) b[i]=a[i]+b[i-1]; int ret=0; map<int,int> mp; for(int i = n-1; i>=;i--){ ret += mp[b[i]]; mp[b[i]]++; } cout << ret + mp[0] << endl; return 0; } }
Submission Info
Submission Time | |
---|---|
Task | A - Zero-Sum Ranges |
User | Sophie1234 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 720 Byte |
Status | CE |
Compile Error
./Main.cpp:5:13: error: template argument 1 is invalid #define int ll; ^ ./Main.cpp:6:19: note: in expansion of macro ‘int’ using VI = vector<int>; ^ ./Main.cpp:5:13: error: template argument 2 is invalid #define int ll; ^ ./Main.cpp:6:19: note: in expansion of macro ‘int’ using VI = vector<int>; ^ ./Main.cpp:6:22: error: expected unqualified-id before ‘>’ token using VI = vector<int>; ^ ./Main.cpp:7:19: error: ‘VI’ was not declared in this scope using VVI =vector<VI>; ^ ./Main.cpp:7:21: error: template argument 1 is invalid using VVI =vector<VI>; ^ ./Main.cpp:7:21: error: template argument 2 is invalid ./Main.cpp:8:7: error: expected nested-name-specifier before ‘PII’ using PII pair<int,int>; ^ ./Main.cpp:8:19: error: expected unqualified-id before ‘,’ token using PII pair<int,int>; ^ ./Main.cpp:5:15: error: expected constructor, destructor,...