Submission #895776

#TimeUsernameProblemLanguageResultExecution timeMemory
895776IsamIzbori (COCI22_izbori)C++17
10 / 110
3051 ms1112 KiB
#include<bits/stdc++.h> using namespace std; constexpr int sz = 500005; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int N; cin >> N; vector<int> A(N); for(int &a : A) cin >> a; auto chk = [&](int l, int r){ map<int, int> mp; for(register int i = l; i <= r; ++i) mp[A[i]]++; int that(0); for(auto &toto : mp) that = max(that, toto.second); return (that << 1) > (r - l + 1); }; int ans(0); for(register int i = 0; i < N; ++i){ for(register int j = i; j < N; ++j){ ans += chk(i, j); } } cout << ans << '\n'; /* 2 2 1 2 3 2; 2; 1; 2; 3; 2 2; 2 2 1; 2 1 2; 2 2 1 2; 2 2 1 2 3; */ return 0; }

Compilation message (stderr)

Main.cpp: In lambda function:
Main.cpp:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |   for(register int i = l; i <= r; ++i) mp[A[i]]++;
      |                    ^
Main.cpp: In function 'int main()':
Main.cpp:20:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |  for(register int i = 0; i < N; ++i){
      |                   ^
Main.cpp:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |   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...