不知道为啥,之前还能46pts,现在直接保龄了
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, m, q, fa[maxn];
bool vis[maxn][2];
vector<int> g[maxn];
int getfa(int x) {
if (fa[x] == x) return x;
return fa[x] = getfa(fa[x]);
}
void dfs(int u, int w) {
vis[u][w] = true;
for (int v : g[u]) {
if (!vis[v][w ^ 1]) dfs(v, w ^ 1);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> m >> q;
for (int i = 1; i <= n; i++) fa[i] = i;
for (int i = 1; i <= m; i++) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
fa[getfa(u)] = getfa(v);
}
for (int i = 1; i <= n; i++) {
if (!vis[i][0] && !vis[i][1]) dfs(i, 0);
}
while (q--) {
int s, t, x;
cin >> s >> t >> x;
if (s == t) {
if (x == 0) {
cout << "tribool\n";
} else if (x % 2 == 1 && (vis[s][0] || vis[s][1])) {
cout << "tribool\n";
} else {
cout << "expand\n";
}
} else if (getfa(s) == getfa(t)) {
if ((x & 1) == 1 && (vis[s][1] && vis[t][0] || vis[s][0] && vis[t][1])) {
cout << "tribool\n";
} else if ((x & 1) == 0 && (vis[s][1] && vis[t][1] || vis[s][0] && vis[t][0])) {
cout << "tribool\n";
} else {
cout << "expand\n";
}
} else {
cout << "expand\n";
}
}
return 0;
}
救救孩子吧,谁有代码啊