Submission #875534

# Submission time Handle Problem Language Result Execution time Memory
875534 2023-11-20T02:12:48 Z Ahmed_Solyman Izbori (COCI22_izbori) C++14
25 / 110
3000 ms 1116 KB
/*
In the name of Allah
made by: Ahmed_Solyman
*/
#include <bits/stdc++.h>
#include <ext/rope>
 
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
    return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
    cout<<(x?"YES":"NO")<<endl;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    fast
    int n;cin>>n;
    vector<int>v(n);
    for(auto &i:v)cin>>i;
    int ans=0;
    for(int i=0;i<n;i++){
        map<int,int>fr;
        int mx=0; 
        for(int j=i;j<n;j++){
            fr[v[j]]++;
            mx=max(mx,fr[v[j]]);
            if(mx>(j-i+1)/2){
                ++ans;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 57 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 49 ms 480 KB Output is correct
10 Correct 50 ms 456 KB Output is correct
11 Correct 49 ms 348 KB Output is correct
12 Correct 49 ms 348 KB Output is correct
13 Correct 49 ms 348 KB Output is correct
14 Correct 49 ms 464 KB Output is correct
15 Correct 49 ms 344 KB Output is correct
16 Correct 49 ms 348 KB Output is correct
17 Correct 21 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3059 ms 1116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 57 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 49 ms 480 KB Output is correct
10 Correct 50 ms 456 KB Output is correct
11 Correct 49 ms 348 KB Output is correct
12 Correct 49 ms 348 KB Output is correct
13 Correct 49 ms 348 KB Output is correct
14 Correct 49 ms 464 KB Output is correct
15 Correct 49 ms 344 KB Output is correct
16 Correct 49 ms 348 KB Output is correct
17 Correct 21 ms 348 KB Output is correct
18 Execution timed out 3059 ms 1116 KB Time limit exceeded
19 Halted 0 ms 0 KB -