Submission #902025

#TimeUsernameProblemLanguageResultExecution timeMemory
902025IsamIzbori (COCI22_izbori)C++17
25 / 110
3029 ms1112 KiB
#include<bits/stdc++.h> using namespace std; int N, A[200005]; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N; for(register int i = 1; i <= N; ++i) cin >> A[i]; int cur_dom(0), ans(0); for(int i = 1; i <= N; ++i){ map<int, int> mp; for(register int j = i; j <= N; ++j){ mp[A[j]]++; if(mp[A[j]] > mp[cur_dom]) cur_dom = A[j]; ans += (mp[cur_dom] > ((j - i + 1) / 2)); } } cout << ans << '\n'; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |  for(register int i = 1; i <= N; ++i) cin >> A[i];
      |                   ^
Main.cpp:13:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |   for(register int j = i; j <= N; ++j){
      |                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...