# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
893479 |
2023-12-27T05:41:40 Z |
vjudge1 |
Izbori (COCI22_izbori) |
C++17 |
|
9 ms |
2268 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
const int N = (int)2e5 + 5;
const ll mod = (int)1e9 + 7;
const ll inf = (int)(1e9) + 100;
map<int, int> ma;
int cnt[N];
void solve() {
int n;
cin >> n;
int a[n + 1];
vector<int> v;
for (int i = 1; i <= n; i++) {
cin >> a[i];
v.pb(a[i]);
}
sort(all(v));
v.erase(unique(all(v)), v.end());
int timer = 0;
for (auto i : v) {
ma[i] = ++timer;
}
for (int i = 1; i <= n; i++) a[i] = ma[a[i]];
if (n <= 300) {
int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
bool g = 0;
for (int k = i; k <= j; k++) {
cnt[a[k]]++;
if (cnt[a[k]] >= n / 2 + 1) {
g = 1;
break;
}
}
ans += g;
}
}
cout << ans;
return;
}
}
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int T = 1;
//cin >> T;
while (T--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |