QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#419680 | #7738. Equivalent Rewriting | Fido_Puppy# | WA | 1ms | 5720kb | C++23 | 1.7kb | 2024-05-24 09:13:10 | 2024-05-24 09:13:10 |
Judging History
answer
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define MT make_tuple
#define IT iterator
#define fi first
#define se second
#define For(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Rep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define CLR(a, v) memset(a, v, sizeof(a))
#define CPY(a, b) memcpy(a, b, sizeof(a))
#define debug cerr << "ztxakking\n"
#define y0 ztxaknoi
#define y1 ztxakioi
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using vi = vector<int>;
template<typename T>
using V = vector<T>;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e5 + 7, inf = 1e9;
int n, m, p[N], a[N];
vi v[N];
void slv() {
cin >> n >> m;
For(i, 1, n) v[i].clear();
For(i, 1, n) {
int len; cin >> len;
For(j, 1, len) {
int x; cin >> x, v[i].pb(x);
}
}
For(i, 1, m) a[i] = 0;
For(i, 1, n) {
for (int j : v[i]) a[j] = i;
}
For(i, 1, n - 1) {
int t = inf;
for (int j : v[i]) {
if (a[j] > i) t = min(t, j);
}
if (t > i + 1) {
cout << "Yes\n";
For(j, 1, i - 1) cout << j << ' ';
cout << i + 1 << ' ' << i << ' ';
For(j, i + 2, n) cout << j << '\n';
return ;
}
}
cout << "No\n";
}
int main() {
// freopen("code.in", "r", stdin) && freopen("code.out", "w", stdout);
ios::sync_with_stdio(0), cin.tie(0);
int t; cin >> t;
while (t--) slv();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5720kb
input:
3 3 6 3 3 1 5 2 5 3 2 2 6 2 3 3 1 3 2 2 3 1 1 3 2 2 1
output:
Yes 2 1 3 No No
result:
wrong answer two transactions are not equivalent. (test case 1)