QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736438 | #8040. Let Them Eat Cake | whp2602765865 | WA | 0ms | 3620kb | C++17 | 630b | 2024-11-12 11:05:16 | 2024-11-12 11:05:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<int>a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0;
while (a.size() > 1)
{
int maxx = 0;
int m = a.size();
for (int i = 0; i < m; i++)
{
if (i == 0)
maxx = max(maxx, a[i + 1]);
else if (i == m - 1)
maxx = max(maxx, a[i - 1]);
else
maxx = max(maxx, min(a[i - 1], a[i + 1]));
}
vector<int>b;
for (int i = 0; i < m; i++)
if (a[i] > maxx)b.push_back(a[i]);
a = b;
ans++;
}
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: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
5 1 5 3 4 2
output:
1
result:
wrong answer 1st numbers differ - expected: '2', found: '1'