# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
851010 | 8pete8 | Tents (JOI18_tents) | C++17 | 93 ms | 71760 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
//#include "supertrees.h"
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define int long long
const int mxn=3003,mod=1000000007,lg=20,root=80,inf=1e18;
void setIO(string name) {
ios_base::sync_with_stdio(0); cin.tie(0);
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
int dp[mxn+10][mxn+10],pl[mxn+10][mxn+10],pu[mxn+10][mxn+10];
int cnt[mxn+10];
int32_t main(){
fastio
int n,m;cin>>n>>m;
for(int i=0;i<=mxn;i++)dp[0][i]=dp[i][0]=1;
for(int i=1;i<=mxn;i++){//main ;to not over count
for(int j=1;j<=mxn;j++){
dp[i][j]+=dp[i-1][j]+(dp[i-1][j-1]*4*j)%mod;
dp[i][j]%=mod;
if(i>=2)dp[i][j]+=(dp[i-2][j-1]*(i-1)*j%mod)%mod;
dp[i][j]%=mod;
if(j>=2)dp[i][j]+=(dp[i-1][j-2]*(((j*(j-1))/2))%mod)%mod;
dp[i][j]%=mod;
}
}
cout<<dp[n][m]-1;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |