列蜜瘘 发表于 2025-6-1 21:09:50

ABC396

ABC396

A

按题意模拟即可
#include using namespace std;const int N = 2e5 + 5;int n, a;int main() {        ios :: sync_with_stdio(0), cin.tie(0);        cin >> n;        for (int i = 1; i > a) {        }                for (int i = 1; i < n - 1; ++i) {                if (a == a && a == a) {                        coutn;        for (int i = 100; i--; s.push_back(0)) {        }         for (int op, x; n--; ) {                cin >> op;                if (op == 1) {                        cin >> x;                        s.push_back(x);                } else {                        coutn >> m;        for (int i = 1; i > a) {        }        for (int i = 1; i > b) {        }        sort (a + 1, a + n + 1, greater());        sort (b + 1, b + m + 1, greater());        for (int i = 1; i = 0 && i0) {                                ans += a + b;                        } else {                                ans += a;                                ++sum;                        }                } else if (a + b > 0 && i0) {                        ans += b, --sum;                } else {                        break;                }        }        return cout > 1;bool v;vector g;void s( int x, int Xor ) {if (v){    return ;}if (x == n) {    ans = min(ans, Xor);    return ;}v = 1;for (auto to : g) {    s(to.first, Xor ^ to.second);}v = 0;}signed main() {        ios :: sync_with_stdio(0), cin.tie(0);        cin >> n >> m;for (int i = 1, x, y, c; i > x >> y >> c;    g.push_back(make_pair(y, c)), g.push_back(make_pair(x, c));}s(1, 0);        return cout > n >> m;for (int i = 1; i > a) {}for (int i = 1; i
页: [1]
查看完整版本: ABC396