結果
問題 | No.612 Move on grid |
ユーザー | kurarrr |
提出日時 | 2018-02-23 15:09:46 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1,087 ms / 2,500 ms |
コード長 | 1,331 bytes |
コンパイル時間 | 1,436 ms |
コンパイル使用メモリ | 170,496 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-16 22:27:17 |
合計ジャッジ時間 | 10,767 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 43 ms
5,376 KB |
testcase_04 | AC | 50 ms
5,376 KB |
testcase_05 | AC | 1,073 ms
5,376 KB |
testcase_06 | AC | 1,084 ms
5,376 KB |
testcase_07 | AC | 25 ms
5,376 KB |
testcase_08 | AC | 1,087 ms
5,376 KB |
testcase_09 | AC | 514 ms
5,376 KB |
testcase_10 | AC | 368 ms
5,376 KB |
testcase_11 | AC | 95 ms
5,376 KB |
testcase_12 | AC | 635 ms
5,376 KB |
testcase_13 | AC | 203 ms
5,376 KB |
testcase_14 | AC | 839 ms
5,376 KB |
testcase_15 | AC | 108 ms
5,376 KB |
testcase_16 | AC | 987 ms
5,376 KB |
testcase_17 | AC | 99 ms
5,376 KB |
testcase_18 | AC | 808 ms
5,376 KB |
testcase_19 | AC | 218 ms
5,376 KB |
testcase_20 | AC | 319 ms
5,376 KB |
ソースコード
#include "bits/stdc++.h" #define ALL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define RREP(i, x, n) for(int i = x; i >= n; i--) #define rrep(i, n) RREP(i,n,0) #define pb push_back #define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;} template<class T> void chmax(T& a,const T& b){a=max(a,b);} template<class T> void chmin(T& a,const T& b){a=min(a,b);} using namespace std; using ll = long long; using P = pair<int,int>; using Pl = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; const int mod=1e9+7,INF=1<<30; const double EPS=1e-12,PI=3.1415926535897932384626; const ll lmod = 1e9+7,LINF=1LL<<60; const int MAX_N = 100005; unordered_map<int,ll> now,nxt; void update(int f,ll x){ if(nxt.count(f)){ (nxt[f] += x) %= lmod; }else{ nxt[f] = x; } } int main(){ int T,a,b,c,d,e,f,g; cin >> T; cin >> a >> b >> c >> d >> e; now[0] = 1; rep(i,T){ nxt.clear(); for(auto u:now){ tie(f,g) = u; update(f+a,g); update(f+b,g); update(f+c,g); update(f-a,g); update(f-b,g); update(f-c,g); } swap(now,nxt); } ll ans = 0LL; for(auto u:now){ tie(f,g) = u; if(f>=d && f<=e) (ans += g) %= lmod; } cout << ans << endl; return 0; }