QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#702365 | #7738. Equivalent Rewriting | heyuhao# | Compile Error | / | / | C++20 | 2.0kb | 2024-11-02 15:51:15 | 2024-11-02 15:51:16 |
Judging History
answer
#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
// #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
#define L_INF 0x7f3f3f3f3f3f3f3f
#define db cout << "debug\n";
using namespace std;
const int Mod = 998244353;
using ll = long long;
vector<int> all[100010];
int last[100010];
int p[100010];
void solve()
{
int n, m;
cin >> n >> m;
for (int i = 0; i <= m; i++)
all[i].clear(), p[i] = 0;
int cnt;
vector<int> last(m + 1, 0);
for (int i = 1; i <= n; i++)
{
cin >> cnt;
for (int j = 0; j < cnt; j++)
{
int x;
cin >> x;
all[i].push_back(x);
last[x] = i;
}
}
int ans = 0;
for (int i = 1; i <= n; i++)
sort(all[i].begin(), all[i].end());
for (int i = n; i > 1; i--)
{
int flag = 0;
for (auto c : all[i])
{
int pos = lower_bound(all[i - 1].begin(), all[i - 1].end(), c) - all[i - 1].begin();
if (last[c] == i && (pos < all[i - 1].size() && all[i - 1][pos] == c))
flag = 1;
p[c] = 1;
}
if (flag == 0)
{
ans = i;
break;
}
// cout << "\n";
}
if (ans)
{
cout << "Yes\n";
for (int i = 1; i < ans - 1; i++)
cout << i << " ";
cout << ans << " " << ans - 1;
for (int i = ans + 1; i <= n; i++)
cout << " " << i;
cout << "\n";
return;
}
cout << "No\n";
}
int main()
{
IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
clock_t start_time = clock();
#endif
int t = 1;
cin >> t;
while (t--)
{
solve();
}
#ifndef ONLINE_JUDGE
cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
return 0;
}
详细
answer.code:12:1: error: ‘vector’ does not name a type 12 | vector<int> all[100010]; | ^~~~~~ answer.code: In function ‘void solve()’: answer.code:20:9: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 20 | all[i].clear(), p[i] = 0; | ^~~ | ll answer.code:22:5: error: ‘vector’ was not declared in this scope 22 | vector<int> last(m + 1, 0); | ^~~~~~ answer.code:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include <iostream> +++ |+#include <vector> 3 | // #include <bits/stdc++.h> answer.code:22:12: error: expected primary-expression before ‘int’ 22 | vector<int> last(m + 1, 0); | ^~~ answer.code:30:13: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 30 | all[i].push_back(x); | ^~~ | ll answer.code:36:14: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 36 | sort(all[i].begin(), all[i].end()); | ^~~ | ll answer.code:36:9: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 36 | sort(all[i].begin(), all[i].end()); | ^~~~ | short answer.code:40:23: error: ‘all’ was not declared in this scope; did you mean ‘ll’? 40 | for (auto c : all[i]) | ^~~ | ll