90pts 帮忙看看哪里有问题
查看原帖
90pts 帮忙看看哪里有问题
775490
JMCJimmyMaker楼主2024/6/9 12:10

评测链接

Code

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n, m;

struct C
{
	ll id, dir;
	string name;
}cir[100100];

int main()
{
	cin >> n >> m;
	for (ll i = 1; i <= n; i++)
	{
		ll d; string s1; cin >> d >> s1;
		cir[i].id = i, cir[i].dir = d, cir[i].name = s1;
	}
	ll pos = 1;
	for (ll i = 1; i <= m; i++)
	{
		ll d, s;
		cin >> d >> s;
		if (cir[pos].dir == d)
		{
			pos = (pos - s + n) % n;
		}
		else
		{
			pos = (pos + s) % n;
		}
	}
	cout << cir[pos].name;
	return 0;
}
2024/6/9 12:10
加载中...