#include <iostream>
#include <cstring>
#include <map>
using namespace std;
#define ll long long
int n;
ll ways = 0;
int arr[200005];
int total[200005];
int highest = 0;
int main(){
//freopen("test.txt", "r", stdin);
cin >> n;
for(int i = 0; i < n; i++) cin >> arr[i];
for(int l = 0; l < n; l++){
int one = 0, two = 0;
for(int r = l; r < n; r++){
if(arr[r] == 1) one++;
else two++;
if(one != two) ways++;
}
}
cout << ways;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3065 ms |
708 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |