# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22526 | 2017-04-30T05:19:54 Z | dried chocochip on Daegu asphalt(#897, suzy, zych1751, Acka) | Unifying Values (KRIII5_UV) | C++11 | 456 ms | 7532 KB |
#include <stdio.h> #include <map> using namespace std; #define MOD 1000000007 typedef long long lli; 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; } map<lli,int>::iterator mi1, mi2; for(int i=1;i<n;++i) { lli sum=0; for(int j=i;j<n;++j) { sum+=a[j]; mi1=d[i-1].find(sum); if(mi1!=d[i-1].end()) { mi2=d[j].find(sum); if(mi2==d[j].end()) { d[j][sum]=mi1->second; mi2=d[j].find(sum); } else { mi2->second+=mi1->second; if(mi2->second>=MOD) mi2->second-=MOD; } } } } int res=0; for(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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1724 KB | Output is correct |
2 | Correct | 0 ms | 1724 KB | Output is correct |
3 | Correct | 0 ms | 1724 KB | Output is correct |
4 | Correct | 213 ms | 7532 KB | Output is correct |
5 | Correct | 219 ms | 7532 KB | Output is correct |
6 | Correct | 329 ms | 2384 KB | Output is correct |
7 | Correct | 196 ms | 6740 KB | Output is correct |
8 | Correct | 229 ms | 6740 KB | Output is correct |
9 | Correct | 233 ms | 6608 KB | Output is correct |
10 | Correct | 223 ms | 4760 KB | Output is correct |
11 | Correct | 276 ms | 4628 KB | Output is correct |
12 | Correct | 233 ms | 4232 KB | Output is correct |
13 | Correct | 249 ms | 6740 KB | Output is correct |
14 | Correct | 243 ms | 6608 KB | Output is correct |
15 | Correct | 216 ms | 6740 KB | Output is correct |
16 | Correct | 203 ms | 6212 KB | Output is correct |
17 | Correct | 229 ms | 6344 KB | Output is correct |
18 | Correct | 263 ms | 4100 KB | Output is correct |
19 | Correct | 263 ms | 4364 KB | Output is correct |
20 | Correct | 206 ms | 3308 KB | Output is correct |
21 | Correct | 216 ms | 2912 KB | Output is correct |
22 | Correct | 306 ms | 2516 KB | Output is correct |
23 | Correct | 373 ms | 2384 KB | Output is correct |
24 | Correct | 333 ms | 2384 KB | Output is correct |
25 | Correct | 303 ms | 2384 KB | Output is correct |
26 | Correct | 293 ms | 2384 KB | Output is correct |
27 | Correct | 246 ms | 4100 KB | Output is correct |
28 | Correct | 206 ms | 3836 KB | Output is correct |
29 | Correct | 229 ms | 4496 KB | Output is correct |
30 | Correct | 293 ms | 4892 KB | Output is correct |
31 | Correct | 313 ms | 5024 KB | Output is correct |
32 | Correct | 279 ms | 5420 KB | Output is correct |
33 | Correct | 253 ms | 4364 KB | Output is correct |
34 | Correct | 329 ms | 4892 KB | Output is correct |
35 | Correct | 263 ms | 5552 KB | Output is correct |
36 | Correct | 213 ms | 5552 KB | Output is correct |
37 | Correct | 199 ms | 5948 KB | Output is correct |
38 | Correct | 203 ms | 5948 KB | Output is correct |
39 | Correct | 223 ms | 5816 KB | Output is correct |
40 | Correct | 219 ms | 5684 KB | Output is correct |
41 | Correct | 196 ms | 6080 KB | Output is correct |
42 | Correct | 216 ms | 5948 KB | Output is correct |
43 | Correct | 196 ms | 6212 KB | Output is correct |
44 | Correct | 219 ms | 5552 KB | Output is correct |
45 | Correct | 233 ms | 5552 KB | Output is correct |
46 | Correct | 199 ms | 5684 KB | Output is correct |
47 | Correct | 196 ms | 6344 KB | Output is correct |
48 | Correct | 219 ms | 6212 KB | Output is correct |
49 | Correct | 203 ms | 6344 KB | Output is correct |
50 | Correct | 219 ms | 6212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 219 ms | 6740 KB | Output is correct |
2 | Correct | 209 ms | 6740 KB | Output is correct |
3 | Correct | 189 ms | 6740 KB | Output is correct |
4 | Correct | 226 ms | 4760 KB | Output is correct |
5 | Correct | 263 ms | 4760 KB | Output is correct |
6 | Correct | 283 ms | 4364 KB | Output is correct |
7 | Correct | 216 ms | 6608 KB | Output is correct |
8 | Correct | 216 ms | 6740 KB | Output is correct |
9 | Correct | 189 ms | 3440 KB | Output is correct |
10 | Correct | 146 ms | 2516 KB | Output is correct |
11 | Correct | 153 ms | 2384 KB | Output is correct |
12 | Correct | 143 ms | 2384 KB | Output is correct |
13 | Correct | 146 ms | 2384 KB | Output is correct |
14 | Correct | 143 ms | 2384 KB | Output is correct |
15 | Correct | 146 ms | 2384 KB | Output is correct |
16 | Correct | 149 ms | 2384 KB | Output is correct |
17 | Correct | 213 ms | 7532 KB | Output is correct |
18 | Correct | 229 ms | 7532 KB | Output is correct |
19 | Correct | 336 ms | 2384 KB | Output is correct |
20 | Correct | 226 ms | 2384 KB | Output is correct |
21 | Correct | 229 ms | 2384 KB | Output is correct |
22 | Correct | 243 ms | 2384 KB | Output is correct |
23 | Correct | 359 ms | 2384 KB | Output is correct |
24 | Correct | 363 ms | 2384 KB | Output is correct |
25 | Correct | 339 ms | 2384 KB | Output is correct |
26 | Correct | 319 ms | 2384 KB | Output is correct |
27 | Correct | 389 ms | 3440 KB | Output is correct |
28 | Correct | 373 ms | 4496 KB | Output is correct |
29 | Correct | 393 ms | 4760 KB | Output is correct |
30 | Correct | 419 ms | 4628 KB | Output is correct |
31 | Correct | 429 ms | 5156 KB | Output is correct |
32 | Correct | 386 ms | 4232 KB | Output is correct |
33 | Correct | 383 ms | 3836 KB | Output is correct |
34 | Correct | 379 ms | 3968 KB | Output is correct |
35 | Correct | 386 ms | 3968 KB | Output is correct |
36 | Correct | 376 ms | 3572 KB | Output is correct |
37 | Correct | 386 ms | 3572 KB | Output is correct |
38 | Correct | 356 ms | 3440 KB | Output is correct |
39 | Correct | 349 ms | 3308 KB | Output is correct |
40 | Correct | 426 ms | 4100 KB | Output is correct |
41 | Correct | 436 ms | 4232 KB | Output is correct |
42 | Correct | 446 ms | 4364 KB | Output is correct |
43 | Correct | 456 ms | 4364 KB | Output is correct |
44 | Correct | 453 ms | 5024 KB | Output is correct |
45 | Correct | 453 ms | 4496 KB | Output is correct |
46 | Correct | 263 ms | 2516 KB | Output is correct |
47 | Correct | 269 ms | 2648 KB | Output is correct |
48 | Correct | 266 ms | 2648 KB | Output is correct |
49 | Correct | 279 ms | 2780 KB | Output is correct |
50 | Correct | 283 ms | 2780 KB | Output is correct |
51 | Correct | 299 ms | 2912 KB | Output is correct |
52 | Correct | 236 ms | 2384 KB | Output is correct |
53 | Correct | 239 ms | 2384 KB | Output is correct |
54 | Correct | 236 ms | 2384 KB | Output is correct |
55 | Correct | 229 ms | 2384 KB | Output is correct |
56 | Correct | 229 ms | 2384 KB | Output is correct |
57 | Correct | 236 ms | 2384 KB | Output is correct |
58 | Correct | 236 ms | 2384 KB | Output is correct |
59 | Correct | 236 ms | 2384 KB | Output is correct |
60 | Correct | 236 ms | 2384 KB | Output is correct |
61 | Correct | 229 ms | 2384 KB | Output is correct |
62 | Correct | 236 ms | 2384 KB | Output is correct |
63 | Correct | 229 ms | 2384 KB | Output is correct |
64 | Correct | 153 ms | 2384 KB | Output is correct |
65 | Correct | 306 ms | 2648 KB | Output is correct |
66 | Correct | 326 ms | 2780 KB | Output is correct |
67 | Correct | 299 ms | 2912 KB | Output is correct |
68 | Correct | 353 ms | 3044 KB | Output is correct |
69 | Correct | 359 ms | 3044 KB | Output is correct |
70 | Correct | 389 ms | 3176 KB | Output is correct |
71 | Correct | 366 ms | 3308 KB | Output is correct |
72 | Correct | 403 ms | 3704 KB | Output is correct |
73 | Correct | 376 ms | 3836 KB | Output is correct |
74 | Correct | 396 ms | 3968 KB | Output is correct |
75 | Correct | 389 ms | 4232 KB | Output is correct |
76 | Correct | 389 ms | 4364 KB | Output is correct |
77 | Correct | 369 ms | 4496 KB | Output is correct |
78 | Correct | 396 ms | 4892 KB | Output is correct |
79 | Correct | 373 ms | 5420 KB | Output is correct |
80 | Correct | 346 ms | 5948 KB | Output is correct |
81 | Correct | 333 ms | 6476 KB | Output is correct |
82 | Correct | 259 ms | 3308 KB | Output is correct |
83 | Correct | 266 ms | 4232 KB | Output is correct |
84 | Correct | 246 ms | 4628 KB | Output is correct |
85 | Correct | 249 ms | 4628 KB | Output is correct |
86 | Correct | 249 ms | 5288 KB | Output is correct |
87 | Correct | 243 ms | 5420 KB | Output is correct |
88 | Correct | 263 ms | 5552 KB | Output is correct |
89 | Correct | 259 ms | 5816 KB | Output is correct |
90 | Correct | 259 ms | 5948 KB | Output is correct |
91 | Correct | 0 ms | 1724 KB | Output is correct |
92 | Correct | 0 ms | 1724 KB | Output is correct |
93 | Correct | 0 ms | 1724 KB | Output is correct |
94 | Correct | 213 ms | 7532 KB | Output is correct |
95 | Correct | 219 ms | 7532 KB | Output is correct |
96 | Correct | 329 ms | 2384 KB | Output is correct |
97 | Correct | 196 ms | 6740 KB | Output is correct |
98 | Correct | 229 ms | 6740 KB | Output is correct |
99 | Correct | 233 ms | 6608 KB | Output is correct |
100 | Correct | 223 ms | 4760 KB | Output is correct |
101 | Correct | 276 ms | 4628 KB | Output is correct |
102 | Correct | 233 ms | 4232 KB | Output is correct |
103 | Correct | 249 ms | 6740 KB | Output is correct |
104 | Correct | 243 ms | 6608 KB | Output is correct |
105 | Correct | 216 ms | 6740 KB | Output is correct |
106 | Correct | 203 ms | 6212 KB | Output is correct |
107 | Correct | 229 ms | 6344 KB | Output is correct |
108 | Correct | 263 ms | 4100 KB | Output is correct |
109 | Correct | 263 ms | 4364 KB | Output is correct |
110 | Correct | 206 ms | 3308 KB | Output is correct |
111 | Correct | 216 ms | 2912 KB | Output is correct |
112 | Correct | 306 ms | 2516 KB | Output is correct |
113 | Correct | 373 ms | 2384 KB | Output is correct |
114 | Correct | 333 ms | 2384 KB | Output is correct |
115 | Correct | 303 ms | 2384 KB | Output is correct |
116 | Correct | 293 ms | 2384 KB | Output is correct |
117 | Correct | 246 ms | 4100 KB | Output is correct |
118 | Correct | 206 ms | 3836 KB | Output is correct |
119 | Correct | 229 ms | 4496 KB | Output is correct |
120 | Correct | 293 ms | 4892 KB | Output is correct |
121 | Correct | 313 ms | 5024 KB | Output is correct |
122 | Correct | 279 ms | 5420 KB | Output is correct |
123 | Correct | 253 ms | 4364 KB | Output is correct |
124 | Correct | 329 ms | 4892 KB | Output is correct |
125 | Correct | 263 ms | 5552 KB | Output is correct |
126 | Correct | 213 ms | 5552 KB | Output is correct |
127 | Correct | 199 ms | 5948 KB | Output is correct |
128 | Correct | 203 ms | 5948 KB | Output is correct |
129 | Correct | 223 ms | 5816 KB | Output is correct |
130 | Correct | 219 ms | 5684 KB | Output is correct |
131 | Correct | 196 ms | 6080 KB | Output is correct |
132 | Correct | 216 ms | 5948 KB | Output is correct |
133 | Correct | 196 ms | 6212 KB | Output is correct |
134 | Correct | 219 ms | 5552 KB | Output is correct |
135 | Correct | 233 ms | 5552 KB | Output is correct |
136 | Correct | 199 ms | 5684 KB | Output is correct |
137 | Correct | 196 ms | 6344 KB | Output is correct |
138 | Correct | 219 ms | 6212 KB | Output is correct |
139 | Correct | 203 ms | 6344 KB | Output is correct |
140 | Correct | 219 ms | 6212 KB | Output is correct |