Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
39222 Gapple 【BJ】T2 C++ 运行出错 0 0 MS 248 KB 1493 2025-12-27 14:08:13

Tests(0/12):


#pragma GCC optimize("Ofast,no-stack-protector,inline,fast-math,unroll-loops,omit-frame-pointer") #define NDEBUG #include <algorithm> #include <array> #include <iostream> #include <random> #include <vector> using namespace std; using i64 = long long; minstd_rand0 rng(random_device {}()); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m, ty; cin >> n >> m >> ty; int K = ty == 0 ? (m + 1) >> 1 : (m * 7 + 7) >> 3; vector<array<vector<int>, 2>> cover; cover.resize(n + 1); for (int i = 0; i < m; ++i) { int x[3], v[3]; cin >> x[0] >> x[1] >> x[2] >> v[0] >> v[1] >> v[2]; for (int j = 0; j < 3; ++j) cover[x[j]][v[j]].push_back(i); } shuffle(cover.begin() + 1, cover.end(), rng); int cnt = 0; vector<bool> covered(m); vector<int> ans(n + 1); for (int i = 1; i <= n && cnt < K; ++i) { int cnts[2] = { 0, 0 }; for (int j = 0; j < 2; ++j) { for (auto k : cover[i][j]) cnts[j] += !covered[k]; } ans[i] = cnts[1] > cnts[0]; for (auto j : cover[i][ans[i]]) { if (!covered[j]) { ++cnt; covered[j] = true; } } } if (cnt < K) cout << "-1"; else { for (int i = 1; i <= n; ++i) cout << ans[i] << ' '; } return 0; }


测评信息: