Submission #526689

#TimeUsernameProblemLanguageResultExecution timeMemory
526689joelauIzbori (COCI22_izbori)C++14
25 / 110
3045 ms840 KiB
#include <bits/stdc++.h> using namespace std; int N,A[200005]; map<int,int> mp; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> N; for (int i = 0; i < N; ++i) cin >> A[i]; long long ans = 0; for (int i = 0; i < N; ++i) { mp.clear(); int most = 0; for (int j = i; j < N; ++j) { most = max(most,++mp[A[j]]); if (most * 2 > j-i+1) ans++; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...