Submission #715049

#TimeUsernameProblemLanguageResultExecution timeMemory
715049Gabriel1219Izbori (COCI22_izbori)C++11
0 / 110
3062 ms988 KiB
#include <bits/stdc++.h> using namespace std; int favourite[200005]; int main() { int n; cin >> n; int ans = 0; for (int i = 0; i < n; i++) cin >> favourite[i]; for (int left = 0; left < n; left++) { for (int right = left; right < n; right++) { int temp1 = 0; int temp2 = 0; for (int i = left; i <= right; i++) { if (favourite[i] == 1) temp1++; else temp2++; } if (2*max(temp1, temp2) > temp1+temp2) ans++; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...