結果
問題 | No.801 エレベーター |
ユーザー | rookzeno |
提出日時 | 2019-03-18 22:27:17 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 212 ms / 2,000 ms |
コード長 | 2,147 bytes |
コンパイル時間 | 1,641 ms |
コンパイル使用メモリ | 171,852 KB |
実行使用メモリ | 87,924 KB |
最終ジャッジ日時 | 2023-09-26 12:20:28 |
合計ジャッジ時間 | 6,624 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,404 KB |
testcase_01 | AC | 2 ms
5,488 KB |
testcase_02 | AC | 2 ms
5,468 KB |
testcase_03 | AC | 5 ms
7,580 KB |
testcase_04 | AC | 5 ms
7,268 KB |
testcase_05 | AC | 5 ms
7,336 KB |
testcase_06 | AC | 5 ms
7,448 KB |
testcase_07 | AC | 5 ms
7,392 KB |
testcase_08 | AC | 6 ms
7,468 KB |
testcase_09 | AC | 6 ms
7,272 KB |
testcase_10 | AC | 5 ms
7,288 KB |
testcase_11 | AC | 5 ms
7,340 KB |
testcase_12 | AC | 6 ms
7,312 KB |
testcase_13 | AC | 204 ms
87,924 KB |
testcase_14 | AC | 204 ms
87,688 KB |
testcase_15 | AC | 206 ms
87,548 KB |
testcase_16 | AC | 204 ms
87,668 KB |
testcase_17 | AC | 205 ms
87,688 KB |
testcase_18 | AC | 206 ms
87,524 KB |
testcase_19 | AC | 205 ms
87,600 KB |
testcase_20 | AC | 205 ms
87,640 KB |
testcase_21 | AC | 212 ms
87,748 KB |
testcase_22 | AC | 205 ms
87,660 KB |
testcase_23 | AC | 199 ms
87,748 KB |
testcase_24 | AC | 207 ms
87,440 KB |
testcase_25 | AC | 208 ms
87,444 KB |
testcase_26 | AC | 206 ms
87,712 KB |
testcase_27 | AC | 203 ms
87,460 KB |
testcase_28 | AC | 202 ms
87,876 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long // aaaaaaaaaaaaaaaaaa #define rep(i,a,n) for (int i=a;i<n;i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(),(x).rend() #define in(s,x) s.find(x) != s.end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define SIZE(buff) (sizeof(buff)/sizeof(buff[0])) typedef vector<int> VI; typedef vector<vector<int> > VVI; typedef long long ll; typedef pair<int,int> PII; typedef vector<pair<int,int>> VPII; const ll mod=1000000007; ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} void chmin(int64_t& a, int64_t b){ a = min(a, b); } template <class T>ostream &operator<<(ostream &o,const vector<T>&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;} template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var) {os << "(" << pair_var.first << ", " << pair_var.second << ")";return os;} // head int m,n,k,res,tmp,tmp2,tmp3,h,w,ans; int a[3200][2] = {}; int b[8000100] = {}; int r[100001][25]; deque<PII> que; string s; map<int,VPII> kukan; vector<PII> g[3000]; //int dp[200000]; int flag; //VPII g2[200000]; int cost[200005]; ll dp[5000][5100] = {}; //VVI g(200005); signed main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n>>m>>k; rep(i,0,m){ cin>>a[i][0]>>a[i][1]; } dp[0][1] = 1; rep(i,0,k){ int rui[n+6]= {}; rep(j,0,n+2){ rui[j+1]=rui[j]+dp[i][j]; rui[j+1] %= mod; } rep(j,0,m){ tmp = rui[a[j][1]+1]+mod - rui[a[j][0]]; tmp %= mod; dp[i+1][a[j][0]]+= tmp; dp[i+1][a[j][1]+1]-= tmp; dp[i+1][a[j][1]+1]+= mod; } rep(j,0,n+1){ dp[i+1][j+1] = dp[i+1][j+1]+dp[i+1][j]; dp[i+1][j+1] %=mod; } } cout<<dp[k][n]%mod<<endl; // rep(i,0,k+1)rep(j,0,n+1)cout<<dp[i][j]<<endl; }