QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623689#8040. Let Them Eat CakeDukerkiWA 18ms3996kbC++20684b2024-10-09 13:43:262024-10-09 13:43:28

Judging History

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

  • [2024-10-09 13:43:28]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:3996kb
  • [2024-10-09 13:43:26]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;
int ans = 0;
void solve(vector<int>& tar) {
    if (tar.size() <= 1)return;
    ans++;
    int s = tar.size();
    vector<int>next;
    for (int i = 0; i < s; i++) {
        int l = (i - 1 + s) % s,r = (i+1+s)%s;
        if (tar[i] < tar[l] || tar[i] < tar[r]) {
            continue;
        }
        else {
            next.push_back(tar[i]);
        }
    }
    solve(next);
}
int main()
{
    int n;
    cin >> n;
    vector<int>ok;
    for (int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        ok.push_back(temp);
    }
    solve(ok);
    cout << ans;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 2 3 4 5

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

5
1 5 3 4 2

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

2
1 2

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 17ms
memory: 3708kb

input:

100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 9995...

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 18ms
memory: 3996kb

input:

100000
28708 58898 66379 81466 37843 38494 7200 13212 70705 98441 68380 79776 45228 18860 96220 19831 27343 59978 23624 87081 30257 26315 23862 7186 37684 193 70599 29284 14627 30319 51080 95350 17977 32253 58304 19841 67584 44345 69298 63002 48446 5959 8500 12298 59988 55130 56346 5380 23327 13969 ...

output:

11

result:

ok 1 number(s): "11"

Test #6:

score: -100
Wrong Answer
time: 14ms
memory: 3856kb

input:

100000
72743 44886 88887 79534 73039 59668 25271 79700 79511 367 86467 30576 66004 39449 41715 4566 91620 76947 63324 90583 85057 86478 73270 85020 28824 27787 24887 1886 22406 74871 46760 36653 48917 12845 39253 48945 16711 32355 1799 30249 83263 24750 74089 94226 11670 71457 55091 2952 20006 73975...

output:

10

result:

wrong answer 1st numbers differ - expected: '11', found: '10'