QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#759411#9353. Interesting PermutationScene#WA 31ms4368kbC++141.9kb2024-11-18 07:54:132024-11-18 07:54:14

Judging History

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

  • [2024-11-18 07:54:14]
  • 评测
  • 测评结果:WA
  • 用时:31ms
  • 内存:4368kb
  • [2024-11-18 07:54:13]
  • 提交

answer

#include<bits/stdc++.h>
#define fo(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
#define rep(i,l,r) for(ll i(l),i##end(r);i<=i##end;++i)
#define per(i,r,l) for(ll i(r),i##end(l);i>=i##end;--i)
#define dbg(x) cerr<<#x<<" "<<x<<'\n';
#define ll long long
#define gc getchar
#define pc putchar
using namespace std;
namespace WrongIO
{
	#define Ts template<typename Ty,typename... Ar>
	#define Tp template<typename Ty>
	Tp Ty wmax(Ty a,Ty b){return a>=b? a:b;}
	Tp Ty wmin(Ty a,Ty b){return a<=b? a:b;}
	Tp void read(Ty &x){x=0;Ty opt=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();if(c=='-')opt=-1,c=gc();while(isdigit(c))x=(x<<3)+(x<<1),x+=c-'0',c=gc();x*=opt;return;}
	Tp void write(Ty x){short OI_USE[150],OI_top=0;if(x<=0) if(x==0)pc('0');else pc('-'),x*=-1;while(x)OI_USE[++OI_top]=x%10,x/=10;while(OI_top--)pc(OI_USE[OI_top+1]+'0');return;}
    void writec(char c[]){int len=strlen(c);for(int i=0;i<len;i++)pc(c[i]);}
    void writes(string s){int len=s.length();for(int i=0;i<len;i++)pc(s[i]);}
    void readc(char &c,int l,int r){c=gc(); while(c!=EOF&&(c<l||c>r)) c=gc();}
    void readc(char &c,char val){c=gc();while(c!=EOF&&c!=val) c=gc();}
    void readc(char val){char c;c=gc();while(c!=EOF&&c!=val) c=gc();}
    void readls(string &s){char c=gc();while(c!='\n') s.push_back(c),c=gc();}
    Ts void read(Ty &x,Ar &...y) {read(x),read(y...);}
    Tp void writeln(Ty x) {write(x),pc('\n');}
    Tp void writesp(Ty x) {write(x),pc(' ');} 
    #undef Ts
	#undef Tp
} using namespace WrongIO;
const ll mod=1e9+7;
ll T,n,h[100050],f;
int main()
{
    read(T);
    while(T--)
    {
        read(n); rep(i,1,n) read(h[i]),f=0;
        if(h[n]==n-1) f=1;
        per(i,n-1,1)
        {
            if(h[i]==h[i+1]) f=f*(h[i]+1-i)%mod;
            else f=f*2%mod;
        }
        writeln(f);
    }
	return 0;
}

//g++ .Yuria.cpp -o rst -std=c++17

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3
0 2 2
3
0 1 2
3
0 2 3

output:

2
4
0

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 31ms
memory: 4368kb

input:

10039
14
5 6 7 8 9 10 11 12 13 13 13 13 13 13
14
0 5 6 7 8 9 10 11 12 13 14 14 14 14
1
1
14
0 5 4 8 9 10 11 12 13 13 13 13 13 13
45
0 1 1 2 2 3 5 5 6 6 8 9 11 13 15 17 18 18 20 22 22 24 26 26 26 26 27 27 27 28 30 32 32 33 34 34 34 36 36 38 38 38 39 39 44
24
0 2 3 5 7 9 9 10 11 12 13 14 14 14 14 15 1...

output:

30720
0
0
30720
0
0
24576
0
0
0
0
0
658159182
0
805306368
8
572589350
12288
2
0
981283070
0
0
2
0
0
0
0
4423680
0
0
14155776
16
0
768
0
0
0
855189487
0
2
0
0
0
0
2
0
2
797370259
0
0
0
0
4
0
0
0
301989888
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
192
0
0
12288
0
0
2
8
0
0
495514526
0
0
955131071
768
0
0
14...

result:

wrong answer 1st lines differ - expected: '0', found: '30720'