結果

問題 No.323 yuki国
ユーザー snuke
提出日時 2015-12-16 00:12:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 2,072 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 85,188 KB
実行使用メモリ 23,552 KB
最終ジャッジ日時 2024-06-28 12:17:20
合計ジャッジ時間 4,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:54:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   54 |   scanf("%d%d",&h,&w);
      |   ~~~~~^~~~~~~~~~~~~~
main.cpp:55:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   55 |   scanf("%d%d%d",&a,&si,&sj);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:56:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   56 |   scanf("%d%d%d",&b,&ti,&tj);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
#define drep(i,n) for(int i = n-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
const int MX = 55, INF = 1000010000;
const ll LINF = 1000000000000000000ll;
const double eps = 1e-10;
const int di[] = {-1,0,1,0}, dj[] = {0,-1,0,1}; //^<v>
int h, w;
int a, si, sj;
int b, ti, tj;
string t[MX];
int d[MX][MX][2005];
struct dat { int i, j, s;};
int main() {
scanf("%d%d",&h,&w);
scanf("%d%d%d",&a,&si,&sj);
scanf("%d%d%d",&b,&ti,&tj);
rep(i,h) cin >> t[i];
queue<dat> q;
d[si][sj][a] = 1;
q.push({si,sj,a});
while (sz(q)) {
dat nd = q.front(); q.pop();
int i = nd.i;
int j = nd.j;
int s = nd.s;
rep(v,4) {
int ni = i+di[v], nj = j+dj[v];
if (ni<0||nj<0||ni>=h||nj>=w) continue;
int ns = s;
if (t[ni][nj] == '*') ++ns; else --ns;
if (ns > 2000) continue;
if (!ns) continue;
if (d[ni][nj][ns]) continue;
q.push({ni,nj,ns});
d[ni][nj][ns] = 1;
}
}
if (d[ti][tj][b]) puts("Yes"); else puts("No");
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0