QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#252396#6739. Teleportucup-team191#Compile Error//C++142.0kb2023-11-15 19:08:572023-11-15 19:08:58

Judging History

你现在查看的是最新测评结果

  • [2023-11-15 19:08:58]
  • 评测
  • [2023-11-15 19:08:57]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=5010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n,k;
string h[N];
bool bio[N][N];
int nex[N][N],dis[N][N];

const bool DEB=1;

pii getNex(int i,int j)
{
	int c=i,dif=j-i;
	while (c<n && c+dif<n && nex[c][c+dif]!=c) c=nex[c][c+dif];
	while (i<n && i+dif<n && nex[i][i+dif]!=i)
	{
		int v=nex[i][i+dif];
		nex[i][i+dif]=c;
		i=v;
	}
	return {i,i+dif};
}

void rem(int i,int j)
{
	bio[i][j]=1;
	nex[i][j]=getNex(i+1,j+1).x;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	memset(dis,63,sizeof(dis));
	cin>>n>>k;
	for (int i=0;i<n;++i) cin>>h[i];
	for (int i=0;i<n;++i) for (int j=0;j<n;++j) nex[i][j]=i;
	queue<pii> q;
	q.push({0,0});
	dis[0][0]=0;
	rem(0,0);
	for (int i=n-1;i>=0;--i) for (int j=0;j<n;++j) if (h[i][j]=='*') rem(i,j);
	while (q.size())ma
	{
		int i=q.front().x,j=q.front().y,d=dis[i][j];
		//cout<<i<<' '<<j<<' '<<d<<endl;
		//bio1[i][j]=bio2[i][j]=1;
		q.pop();
		if (i==n-1 && j==n-1)
		{
			cout<<d<<en;
			exit(0);
		}
		while (1)
		{
			pii r=getNex(i,j);
			int i1=r.x,j1=r.y;
			//cout<<i<<' '<<j<<' '<<i1<<' '<<j1<<endl;
			if (i1<0 || j1<0 || i1>=n || j1>=n) break;
			if (i1-i>k/2) break;
			dis[i1][j1]=d+1;
			rem(i1,j1);
			q.push({i1,j1});
		}
		while (1)
		{
			pii r=getNex(j+1,i);
			int i1=r.x,j1=r.y;
			if (i1<0 || j1<0 || i1>=n || j1>=n) break;
			if (j1-i>(k-1)/2) break;
			dis[i1][j1]=d+1;
			rem(i1,j1);
			q.push({i1,j1});
		}
		for (int u=0;u<4;++u)
		{
			int i1=i+dx[u],j1=j+dy[u];
			if (i1<0 || j1<0 || i1>=n || j1>=n) continue;
			if (bio[i1][j1]) continue;
			if (h[i1][j1]=='*') continue;
			dis[i1][j1]=d+1;
			rem(i1,j1);
			q.push({i1,j1});
		}
	}
	cout<<-1<<en;
}

Details

answer.code: In function ‘int main()’:
answer.code:56:25: error: ‘ma’ was not declared in this scope; did you mean ‘fma’?
   56 |         while (q.size())ma
      |                         ^~
      |                         fma