# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1106162 | atom | Izbori (COCI22_izbori) | C++17 | 3046 ms | 1104 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
// @JASPER'S BOILERPLATE
using namespace std;
using ll = long long;
#ifdef JASPER
#include "debug.h"
#else
#define debug(...) 166
#endif
signed main() {
cin.tie(0) -> sync_with_stdio(0);
#ifdef JASPER
freopen("in3", "r", stdin);
#endif
int n;
cin >> n;
vector <int> a(n + 1);
for (int i = 1; i <= n; ++i)
cin >> a[i];
ll ans = 0;
for (int l = 1; l <= n; ++l) {
map <int, int> cnt;
pair <int, int> mx = {0, 0};
for (int r = l; r <= n; ++r) {
cnt[a[r]]++;
if (cnt[a[r]] > mx.second) {
mx = make_pair(a[r], cnt[a[r]]);
}
if (mx.second > (r - l + 1) / 2) {
debug(l, r);
++ans;
}
}
}
cout << ans << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |