Submission #893751

# Submission time Handle Problem Language Result Execution time Memory
893751 2023-12-27T10:51:39 Z vjudge1 Izbori (COCI22_izbori) C++17
25 / 110
3000 ms 1372 KB
#include <bits/stdc++.h>
#define ll long long
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define ull unsigned long long
using namespace std;
const ll mod = 1e9 + 7;
const ll N = 5e5 + 5;
const ll P = 337ll;
ll n,q,k;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
ll a[n];
for(ll i = 0; i<n; i++) {
    cin>>a[i];
}
ll ans = 0;
for(ll i = 0; i<n; i++) {
        ll maxi = 0;
        map <ll,ll> cnt;
    for(ll j = i; j<n; j++) {
        cnt[a[j]]++;
        maxi = max(cnt[a[j]], maxi);
        if(maxi > (j - i + 1) / 2) {
            //cout<<maxi<<" "<<i<<" "<<j<<" "<<(j - i + 1) / 2<<"\n";
            ans++;
        }
    }
}
cout<<ans;
return 0;
}
// equal, min, max, 1, random
/*

*/
# Verdict Execution time Memory Grader output
1 Correct 0 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 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 58 ms 488 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 46 ms 344 KB Output is correct
10 Correct 43 ms 444 KB Output is correct
11 Correct 42 ms 348 KB Output is correct
12 Correct 42 ms 348 KB Output is correct
13 Correct 42 ms 344 KB Output is correct
14 Correct 42 ms 344 KB Output is correct
15 Correct 42 ms 600 KB Output is correct
16 Correct 42 ms 348 KB Output is correct
17 Correct 7 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 1372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 58 ms 488 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 46 ms 344 KB Output is correct
10 Correct 43 ms 444 KB Output is correct
11 Correct 42 ms 348 KB Output is correct
12 Correct 42 ms 348 KB Output is correct
13 Correct 42 ms 344 KB Output is correct
14 Correct 42 ms 344 KB Output is correct
15 Correct 42 ms 600 KB Output is correct
16 Correct 42 ms 348 KB Output is correct
17 Correct 7 ms 348 KB Output is correct
18 Execution timed out 3065 ms 1372 KB Time limit exceeded
19 Halted 0 ms 0 KB -