結果
問題 |
No.2900 Star Divine
|
ユーザー |
![]() |
提出日時 | 2024-09-25 20:37:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,204 bytes |
コンパイル時間 | 2,001 ms |
コンパイル使用メモリ | 202,500 KB |
最終ジャッジ日時 | 2025-02-24 12:30:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int N = 1e5 + 5; mt19937_64 rnd(time(0)); int x, y, m, u, v, now, cnt, a[N], b[N], T; set<int>g[N]; void S(){ cin >> x >> y >> m; for(int i = 1; i <= x; ++i){ g[i].clear(); } for(int i = 1; i <= m; i++){ cin >> u >> v; g[u].insert(v); } for(int i = 1; i <= 10; ++i){ cnt = 0; for(int j = 1; j <= y; ++j){ a[j] = rnd() % 2; cnt += a[j]; } for(int j = 1; j <= x; ++j){ now = 0; for(auto v : g[j]){ if(a[v]){ now++; } } b[j] = now % 2; cnt += b[j]; } if(cnt >= (x + y + 1) / 2){ vector<int>e1, e2; for(int j = 1; j <= x; ++j){ if(b[j]){ e1.push_back(j); } } for(int j = 1; j <= y; ++j){ if(a[j]){ e2.push_back(j); } } cout << e1.size() << ' ' << e2.size() << '\n'; for(auto v : e1){ cout << v << ' '; } cout << '\n'; for(auto v : e2){ cout << v << ' '; } cout << "\n\n"; return ; } } } int main(){ ios::sync_with_stdio(0), cin.tie(0); for(cin >> T; T--; S()){ } return 0; }