Submission #1114477

#TimeUsernameProblemLanguageResultExecution timeMemory
1114477ezzzayIzbori (COCI22_izbori)C++14
25 / 110
3055 ms1104 KiB
#include<bits/stdc++.h> using namespace std; const int N=3e5+5; int a[N]; signed main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } int cnt=0; for(int i=1;i<=n;i++){ map<int,int>mp; bool u=0; int mx=0; for(int j=i;j<=n;j++){ mp[a[j]]++; mx=max(mx,mp[a[j]]); cnt+=(mx*2>(j-i+1)); } } cout<<cnt; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:14:14: warning: unused variable 'u' [-Wunused-variable]
   14 |         bool u=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...