結果
問題 | No.2646 Cycle Maze |
ユーザー | matcharate12 |
提出日時 | 2024-02-11 13:34:29 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,811 bytes |
コンパイル時間 | 1,753 ms |
コンパイル使用メモリ | 180,516 KB |
実行使用メモリ | 79,744 KB |
最終ジャッジ日時 | 2024-09-29 10:59:47 |
合計ジャッジ時間 | 25,795 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | OLE | - |
testcase_48 | WA | - |
testcase_49 | OLE | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | OLE | - |
testcase_54 | OLE | - |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(ll i = 0; i < n; i++) //[0,n) #define srep(i,a,b) for(ll i = a; i < b; i++) //[a,b) #define all(A) (A).begin(),(A).end() #define rall(A) (A).rbegin(),(A).rend() #define pmt(A) next_permutation(all(A)) using namespace std; using ll = long long; using ull = unsigned long long; using P = pair<ll,ll>; using pq = priority_queue<P,vector<P>,greater<P>>; ll inf = 1LL<<60; int iinf = (int)1e9+1; int mod9 = 998244353; int mod1 = 1000000007; struct Edge { int to; int cost; int from; }; bool compe(const Edge &e,const Edge &e2){ return e.cost < e2.cost; } using Graph = vector<vector<ll>>; using SGraph = vector<set<ll>>; template <typename T> int siz(T& a){return (int)a.size();} ll squa(ll a){ return a*a; } ll ceil(ll a,ll b){ return (a+b-1)/b; } int H,W,T; vector<vector<vector<int>>> seen; int dx[5] = {0,0,0,-1,1}; int dy[5] = {0,1,-1,0,0}; void dfs(const vector<string> &S,int y,int x,int t){ if(t >= T) return; seen[t][y][x] = 1; //cout << t << " " << y << " " << x << endl; rep(i,5){ int ny = y+dy[i],nx = x+dx[i]; if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue; int c = S[ny][nx]-'0'; int mod = (-(t+1))%(c+1); while(mod < 0) mod += c+1; if(mod == 0) continue; if(seen[t+1][ny][nx]) continue; dfs(S,ny,nx,t+1); } } int main(void){ cin >> H >> W >> T; int sy,sx,gy,gx; cin >> sy >> sx >> gy >> gx; sx--; sy--; gy--; gx--; vector<string> S(H); rep(i,H) cin >> S[i]; srep(t,2,T+1){ rep(i,H){ rep(j,W){ int c = (-t)%((S[i][j]-'0')+1); while(c < 0) c += S[i][j]-'0'+1; cout << c; } cout << "\n"; } cout << "\n"; } seen.assign(T+1,vector<vector<int>>(H,vector<int>(W,0))); seen[0][sy][sx] = 1; dfs(S,sy,sx,0); bool ok = 0; rep(i,T+1) ok |= seen[i][gy][gx]; cout << (ok ? "Yes" : "No"); }