QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#756879 | #8040. Let Them Eat Cake | Soorraw | WA | 6ms | 4508kb | C++17 | 1021b | 2024-11-16 22:25:36 | 2024-11-16 22:25:37 |
Judging History
answer
#define push_back pb
#define first fst
#define second sec
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef array<int,3> ai3;
typedef array<ll,3> al3;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef double db;
const int N=1e5+10,M=11,inf=0x3f3f3f3f,mod=1e9+7;//998244353;
const ll inff=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
void solve()
{
int n;
cin>>n;
vi a(n+1),vis(n+1);
for(int i=1;i<=n;i++)
cin>>a[i];
int ans=0,cnt=0;
while(cnt<n-1)
{
ans++;
vi evt(1,0);
for(int i=1;i<=n;i++)
if(!vis[i])
evt.pb(a[i]);
evt.pb(0);
int sz=evt.size();
for(int i=1;i<sz-1;i++)
if(evt[i]<evt[i-1]||evt[i]<evt[i+1])
{
vis[i]=1;
cnt++;
}
}
cout<<ans<<'\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T=1;
// cin>>T;
while(T--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
5 1 2 3 4 5
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5 1 5 3 4 2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 5ms
memory: 4508kb
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: -100
Wrong Answer
time: 6ms
memory: 4492kb
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:
3
result:
wrong answer 1st numbers differ - expected: '11', found: '3'