# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
895776 | Isam | Izbori (COCI22_izbori) | C++17 | 3051 ms | 1112 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
constexpr int sz = 500005;
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int N;
cin >> N;
vector<int> A(N);
for(int &a : A) cin >> a;
auto chk = [&](int l, int r){
map<int, int> mp;
for(register int i = l; i <= r; ++i) mp[A[i]]++;
int that(0);
for(auto &toto : mp) that = max(that, toto.second);
return (that << 1) > (r - l + 1);
};
int ans(0);
for(register int i = 0; i < N; ++i){
for(register int j = i; j < N; ++j){
ans += chk(i, j);
}
}
cout << ans << '\n';
/*
2 2 1 2 3
2;
2;
1;
2;
3;
2 2;
2 2 1;
2 1 2;
2 2 1 2;
2 2 1 2 3;
*/
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... |