蒟蒻10分求助,除了第4个点都寄了
查看原帖
蒟蒻10分求助,除了第4个点都寄了
648626
WL_GhHz楼主2023/8/21 21:34
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;
int a[1010][2020],n,m,x,y;
int main()
{
	cin>>m>>n>>x>>y;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=2*m;j++)
			cin>>a[i][j];
	}
	cout<<x<<" "<<y;
	while(1)
	{
		int tmpx,tmpy;
		tmpx=a[x][2*y-1];
		tmpy=a[x][2*y];
		if(tmpx==0&&tmpy==0)	return 0;
		cout<<tmpx<<" "<<tmpy<<endl;
		x=tmpx;
		y=tmpy;
	}
	return 0;
}
2023/8/21 21:34
加载中...