Submission #2532712
Source Code Expand
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <math.h>
#include <string>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn = 100100;
int n;
ll s, res;
map <ll,int> mp;
void solve(){
scanf("%d", &n);
mp[0ll] = 1;
for(int i = 1, x; i <= n; i ++){
scanf("%d", &x);
s += x;
res += mp[s];
mp[s] ++;
}
printf("%I64d", res);
}
int main(){
int t = 1;
while(t --){
solve();
}
}
Submission Info
Submission Time
2018-05-20 20:55:37+0900
Task
A - Zero-Sum Ranges
User
Isfandiyor
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
822 Byte
Status
WA
Exec Time
86 ms
Memory
12800 KB
Compile Error
./Main.cpp: In function ‘void solve()’:
./Main.cpp:43:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll {aka long long int}’ [-Wformat=]
printf("%I64d", res);
^
./Main.cpp:35:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:38:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &x);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 200
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt, sample_03.txt
All
sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt
Case Name
Status
Exec Time
Memory
sample_01.txt
AC
5 ms
896 KB
sample_02.txt
AC
1 ms
256 KB
sample_03.txt
AC
1 ms
256 KB
subtask_1_01.txt
AC
1 ms
256 KB
subtask_1_02.txt
AC
1 ms
256 KB
subtask_1_03.txt
AC
36 ms
3712 KB
subtask_1_04.txt
AC
8 ms
384 KB
subtask_1_05.txt
AC
19 ms
384 KB
subtask_1_06.txt
AC
84 ms
12800 KB
subtask_1_07.txt
AC
32 ms
512 KB
subtask_1_08.txt
AC
22 ms
256 KB
subtask_1_09.txt
WA
17 ms
256 KB
subtask_1_10.txt
WA
85 ms
8064 KB
subtask_1_11.txt
AC
43 ms
384 KB
subtask_1_12.txt
AC
44 ms
384 KB
subtask_1_13.txt
WA
86 ms
8064 KB
subtask_1_14.txt
AC
43 ms
384 KB
subtask_1_15.txt
AC
43 ms
384 KB