Submission #1114477

# Submission time Handle Problem Language Result Execution time Memory
1114477 2024-11-19T01:56:27 Z ezzzay Izbori (COCI22_izbori) C++14
25 / 110
3000 ms 1104 KB
#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

Main.cpp: In function 'int main()':
Main.cpp:14:14: warning: unused variable 'u' [-Wunused-variable]
   14 |         bool u=0;
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 444 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 444 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 49 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 32 ms 464 KB Output is correct
10 Correct 33 ms 336 KB Output is correct
11 Correct 33 ms 336 KB Output is correct
12 Correct 39 ms 464 KB Output is correct
13 Correct 33 ms 468 KB Output is correct
14 Correct 32 ms 504 KB Output is correct
15 Correct 33 ms 644 KB Output is correct
16 Correct 33 ms 476 KB Output is correct
17 Correct 13 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3055 ms 1104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 444 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 49 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 32 ms 464 KB Output is correct
10 Correct 33 ms 336 KB Output is correct
11 Correct 33 ms 336 KB Output is correct
12 Correct 39 ms 464 KB Output is correct
13 Correct 33 ms 468 KB Output is correct
14 Correct 32 ms 504 KB Output is correct
15 Correct 33 ms 644 KB Output is correct
16 Correct 33 ms 476 KB Output is correct
17 Correct 13 ms 592 KB Output is correct
18 Execution timed out 3055 ms 1104 KB Time limit exceeded
19 Halted 0 ms 0 KB -