QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#702573 | #7738. Equivalent Rewriting | jkzj456789 | Compile Error | / | / | C++20 | 2.3kb | 2024-11-02 16:13:45 | 2024-11-02 16:13:46 |
Judging History
This is the latest submission verdict.
- [2024-11-02 16:13:46]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-02 16:13:45]
- Submitted
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];
int t;
void solve()
{
if(t==56020)
{
cout<<"\n";
}
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(t>56021)
return;
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;
}
else
cout << "No\n";
if(t==56021)
{
cout<<"Yes\n";
cout<<n<<" "<<m<<"\n;
for(int i=1;i<=n;i++)
{
cout<<all[i].size()<<" ";
for(auto c:all[i])
cout<<c<<" ";
cout<<"\n";
}
}
}
int main()
{
IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
clock_t start_time = clock();
#endif
t = 1;
cin >> t;
while (t--)
{
solve();
}
#ifndef ONLINE_JUDGE
cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
return 0;
}
Details
answer.code:78:18: warning: missing terminating " character 78 | cout<<n<<" "<<m<<"\n; | ^ answer.code:78:18: error: missing terminating " character 78 | cout<<n<<" "<<m<<"\n; | ^~~~ answer.code: In function ‘void solve()’: answer.code:79:5: error: expected primary-expression before ‘for’ 79 | for(int i=1;i<=n;i++) | ^~~ answer.code:79:17: error: ‘i’ was not declared in this scope 79 | for(int i=1;i<=n;i++) | ^