結果
| 問題 |
No.2900 Star Divine
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-28 18:36:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,234 bytes |
| コンパイル時間 | 3,291 ms |
| コンパイル使用メモリ | 281,644 KB |
| 実行使用メモリ | 13,820 KB |
| 最終ジャッジ日時 | 2024-09-28 18:36:56 |
| 合計ジャッジ時間 | 4,355 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
ソースコード
#include <bits/stdc++.h>
#define _1 (__int128)1
using namespace std;
using ll = long long;
void FileIO (const string s) {
freopen(string(s + ".in").c_str(), "r", stdin);
freopen(string(s + ".out").c_str(), "w", stdout);
}
const int N = 1e5 + 10;
int T, n, m, ed, stk[N], top, stk_[N], top_, ans, lst[N];
set<int> g[N];
bool f[N];
void Solve () {
mt19937 rnd(time(0));
cin >> n >> m >> ed, top = top_ = 0;
for (int i = 1; i <= n; i++) g[i] = set<int> ();
for (int i = 1; i <= m; i++) f[i] = 0, lst[i] = 0;
for (int i = 1, x, y; i <= ed; i++)
cin >> x >> y, g[y].insert(x), lst[x] = max(lst[x], y);
for (int i = 1; i <= n; i++) {
int cnt = 1, cnt_ = 0;
for (int j : g[i])
if (i == lst[j])
cnt += !f[j], cnt_ += f[j];
if (cnt > cnt_) {
stk[++top] = i;
for (int j : g[i]) f[j] ^= 1;
}
}
for (int i = 1; i <= m; i++)
if (f[i])
stk_[++top_] = i;
cout << top << ' ' << top_ << '\n';
for (int i = 1; i <= top; i++)
cout << stk[i] << ' ';
cout << '\n';
for (int i = 1; i <= top_; i++)
cout << stk_[i] << ' ';
}
signed main () {
ios::sync_with_stdio(0), cin.tie(0);
// FileIO("");
for (cin >> T; T--; Solve(), cout << '\n') {}
return 0;
}
vjudge1