## Editorial for CCC '17 S1 - Sum Game

Remember to use this editorial

**only**when stuck, and**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.**Submitting an official solution before solving the problem yourself is a bannable offence.**Author:

Keep track of the sum of the scores for both teams, and record the index if the sums are the same.

**Time Complexity:**

#### Sample Solution — D

```
import std.stdio;
int N, ans;
int[100004] r1, r2;
long s1, s2;
void main() {
scanf("%d", &N);
for(int i=0;i<N;i++)
scanf("%d", &r1[i]);
for(int i=0;i<N;i++)
scanf("%d", &r2[i]);
for(int i=0;i<N;i++) {
s1 += r1[i];
s2 += r2[i];
if(s1 == s2) ans = i + 1;
}
printf("%d", ans);
}
```

## Comments

is this in java or javascript?

This is in the D programming language. It's similar to C++.

Oh because C + 1 is D ohhh

This comment is hidden due to too much negative feedback. Click here to view it.

no