답안 #1106162

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106162 2024-10-29T11:56:00 Z atom Izbori (COCI22_izbori) C++17
25 / 110
3000 ms 1104 KB
#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;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:9:20: warning: statement has no effect [-Wunused-value]
    9 | #define debug(...) 166
      |                    ^~~
Main.cpp:37:17: note: in expansion of macro 'debug'
   37 |                 debug(l, r);
      |                 ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 48 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 33 ms 484 KB Output is correct
10 Correct 39 ms 504 KB Output is correct
11 Correct 34 ms 336 KB Output is correct
12 Correct 39 ms 336 KB Output is correct
13 Correct 34 ms 336 KB Output is correct
14 Correct 34 ms 504 KB Output is correct
15 Correct 34 ms 504 KB Output is correct
16 Correct 33 ms 336 KB Output is correct
17 Correct 10 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3046 ms 1104 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 48 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 33 ms 484 KB Output is correct
10 Correct 39 ms 504 KB Output is correct
11 Correct 34 ms 336 KB Output is correct
12 Correct 39 ms 336 KB Output is correct
13 Correct 34 ms 336 KB Output is correct
14 Correct 34 ms 504 KB Output is correct
15 Correct 34 ms 504 KB Output is correct
16 Correct 33 ms 336 KB Output is correct
17 Correct 10 ms 336 KB Output is correct
18 Execution timed out 3046 ms 1104 KB Time limit exceeded
19 Halted 0 ms 0 KB -