TLE 求调
查看原帖
TLE 求调
804607
rainygame楼主2023/6/14 17:58
#include <bits/stdc++.h>
using namespace std;
#define MAXN 101

int n, m, x, nowp(1), k, flag;
int front[MAXN];
bitset<MAXN> vis;

int main(){
//	ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	
	cin >> n >> m;
	while (true){
		vis.set(nowp);
		cin >> k;
		flag = 0;
		while (k--){
			cin >> x;
			if (!vis.test(x) && !flag){
				nowp = x;
				front[nowp] = x;
				flag = 1;
			}
		}
		if (!flag) nowp = front[nowp];
		
		cout << nowp << '\n';
		fflush(stdout);
		if (nowp == n) return 0;
	}
	
	return 0;
}

2023/6/14 17:58
加载中...