QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#835692#9917. The Story of Emperor Bieucup-team5243#WA 18ms3620kbC++171.1kb2024-12-28 13:58:592024-12-28 13:59:00

Judging History

你现在查看的是最新测评结果

  • [2024-12-28 13:59:00]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:3620kb
  • [2024-12-28 13:58:59]
  • 提交

answer

#ifdef NACHIA
#define _GLIBCXX_DEBUG
#else
#define NDEBUG
#endif
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<int(n); i++)
const i64 INF = 1001001001001001001;
template<typename A> void chmin(A& l, const A& r){ if(r < l) l = r; }
template<typename A> void chmax(A& l, const A& r){ if(l < r) l = r; }
using namespace std;

void testcase(){
    i64 N; cin >> N;
    vector<i64> A(N); rep(i,N) cin >> A[i];
    int a = *max_element(A.begin(), A.end());
    vector<int> I(N);
    for(int l=0; l<N; l++) if(A[l] == a){ I[l] = 1; break; }
    for(int l=N-1; l>=0; l--) if(A[l] == a){ I[l] = 1; break; }
    rep(i,N-1) if(A[i] == A[i+1]) I[i+1] |= I[i];
    for(int i=N-2; i>=0; i--) if(A[i] == A[i+1]) I[i] |= I[i+1];
    vector<int> ans;
    rep(i,N) if(I[i]) ans.push_back(i);
    rep(i,ans.size()){
        if(i) cout << " ";
        cout << (ans[i]+1);
    } cout << "\n";
}

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int T; cin >> T;
    rep(t,T) testcase();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

3
1
5
2
1 3
3
3 3 3

output:

1
2
1 2 3

result:

ok 5 number(s): "1 2 1 2 3"

Test #2:

score: -100
Wrong Answer
time: 18ms
memory: 3520kb

input:

10000
25
25 39 31 40 11 29 9 4 42 32 39 5 21 33 19 50 19 20 7 41 13 45 34 23 7
6
33 14 11 25 24 37
6
50 35 17 42 37 10
11
22 17 45 17 48 29 2 42 19 19 50
91
12 27 3 20 37 39 4 48 4 29 44 37 38 11 39 15 38 28 20 19 50 20 48 28 43 6 19 16 7 10 30 44 9 25 13 9 21 8 3 39 11 10 34 28 23 13 49 44 45 4 23 ...

output:

16
6
1
11
21 91
14
17 30
10
14 17
31 98
53 66
19
11
7 17
4
71 87
40 79
96
2 66
2
46
2
1
14 62
47 94
45
1 12
1
16
33 45
1
3 45
4 62
6
4
37 75
54 92
33 79
7
2 32
27 77
10
7 34
41
9
88
68
2 42
2
17 28
6
32
5
12
80
20
23 40
22 79
14
24 72
40 100
16
7
27 31
27
58
34
8
1
1
4
8
12 44
43
1
18
5
3
5
29 69
4 ...

result:

wrong answer 6th numbers differ - expected: '70', found: '91'