QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#128289 | #1171. Integer Array Shuffle | starrylasky | WA | 0ms | 3736kb | C++14 | 1.1kb | 2023-07-20 20:10:39 | 2023-07-20 20:10:40 |
Judging History
answer
///yl/hs/bx/yl
#include<bits/stdc++.h>
#define fep(i,l,r) for(int i=l;i<=r;++i)
#define feb(i,r,l) for(int i=r;i>=l;--i)
#define For(i,u) for(int i=head[u];i;i=e[i].nxt)
#define LL long long
// #define int long long
#define ld long double
#define pr pair<int,int>
#define mpr make_pair
using namespace std;
const int N = 1e6+5,mod = 1e9+7;
inline int read()
{
int s=0,w=1; char ch=getchar();
while(!(ch>='0'&&ch<='9')) {if(ch=='-') w=-1; ch=getchar();}
while( ch>='0'&&ch<='9') {s=(s<<1)+(s<<3)+ch-'0'; ch=getchar();}
return s*w;
}
inline int Mod(int x) {return x>=mod?x-mod:x;}
inline void addmod(int &x,int y) {x=Mod(x+y);}
namespace starrylasky
{
int n,a[N];
inline void Main()
{
n=read();
fep(i,1,n)
{
int x=read(); if(x==a[i-1]) --i,--n;
a[i]=x;
}
int cnt=0;
fep(i,1,n) if(a[i-1]<a[i]&&a[i]>a[i+1]) ++cnt;
// cerr<<cnt<<"\n";
printf("%d\n",cnt==0?0:(int)ceil(log2(cnt))+1);
}
}
signed main()
{
int _T=1;
while(_T--) starrylasky::Main();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3736kb
input:
3 2 2 5
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'