QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#128293#1171. Integer Array ShufflestarrylaskyWA 1ms3924kbC++141.1kb2023-07-20 20:11:472023-07-20 20:11:49

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-20 20:11:49]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3924kb
  • [2023-07-20 20:11:47]
  • 提交

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-1) 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: 100
Accepted
time: 0ms
memory: 3656kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

8
14253630 18210471 431833031 681754868 791250850 811241570 837112104 858531105

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

7
4 2 4 2 5 3 4

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

8
92691902 57877007 167221695 197382747 709013587 643114183 962487887 112336349

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: -100
Wrong Answer
time: 1ms
memory: 3796kb

input:

8
14253630 811241570 18210471 431833031 858531105 837112104 681754868 791250850

output:

2

result:

wrong answer 1st numbers differ - expected: '3', found: '2'