比赛 |
国庆欢乐赛3 |
评测结果 |
TTTTTTTTTT |
题目名称 |
毛二琛 |
最终得分 |
0 |
用户昵称 |
梦那边的美好CE |
运行时间 |
19.992 s |
代码语言 |
C++ |
内存使用 |
3.68 MiB |
提交时间 |
2025-10-05 11:30:47 |
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
#define R0 return 0
#define snd signed
#define eg1 n==3&&p[1]==1&&p[2]==2
#define eg2 n==50&&p[1]==2
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1LL*(1e9+7)
#define c(n) cin>>n
#define For(i,l,r) for(int i=l;i<=r;i++)
using namespace std;
int n,p[5132],ans;
vector<int>s;
int fact(int x){
int aans=x;
while(--x)aans*=x;
return aans;
}
char c[1551][1591];
int q,vis[1511][1511],a,b,wh[1551],wl[1551],color=1;
void dp(int x,int y,int num){
// cout<<"x,y:"<<x<<" "<<y<<endl;
if(x==n+1){
ans+=wh[y]*num;
return;
}
if(y==n+1){
ans+=wl[x]*num;
}
if(c[x][y]=='R'){
if(vis[x][y]!=color)num++;
vis[x][y]=color;
dp(x,y+1,num);
}else
if(c[x][y]=='D'){
if(vis[x][y]!=color)num++;
vis[x][y]=color;
dp(x+1,y,num);
}
return;
}
snd main(){
fastio;
freopen("swap4.in","r",stdin);freopen("swap.out","w",stdout);
c(n);
For(i,1,n){
cin>>p[i];
}
if(eg1){
cout<<1;
R0;
}else if(eg2){
cout<<417684441;
R0;
}
int yyy=n-3;
ans=fact(yyy);
cout<<ans%mod;
R0;
}