错误信息:
Wrong Answer.wrong answer On line 1 column 1, read - , expected 4
下载的正确输出如下:
459
蒟蒻代码:
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#define stn frm[x + trn[i][0] + 1][y + trn[i][1] + 1]
#define nxtx x.x + trn[i][0]
#define nxty x.y + trn[i][1]
#define m10(x) ((x << 3) + (x << 1))
using namespace std;
int m, x, y, t, frm[303][303];
int trn[5][2] = {0, 0, -1, 0, 1, 0, 0, -1, 0, 1};
struct pos {int x, y, t;} np;
queue<pos> q;
inline int qread()
{
int tmp = getchar(), ot = 0;
while (tmp < '0' || tmp > '9')
tmp = getchar();
while (tmp >= '0' && tmp <= '9')
{
ot = m10(ot);
ot += tmp ^ 48;
tmp = getchar();
}
return ot;
}
inline int bfs()
{
while (!q.empty())
{
pos x = q.front();
q.pop();
for (int i = 1; i < 5; ++i)
{
if (frm[nxtx][nxty] <= x.t)
continue;
if (nxtx < 1 || nxtx > 301 || nxty < 1 || nxty > 301)
continue;
if (frm[nxtx][nxty] == 0x3f3f3f3f)
return x.t;
frm[nxtx][nxty] = -1;
np.x = nxtx, np.y = nxty, np.t = x.t + 1;
q.push(np);
}
}
return -1;
}
int main()
{
memset(frm, 0x3f, sizeof(frm));
m = qread();
while (m--)
{
x = qread();
y = qread();
t = qread();
for (int i = 0; i < 5; ++i)
stn = min(stn, t);
}
if(frm[1][1] == 0x3f3f3f3f)
{
printf("0");
return 0;
}
np.x = np.y = np.t = 1;
frm[1][1] = -1;
q.push(np);
printf("%d", bfs());
return 0;
}