QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619945 | #7738. Equivalent Rewriting | Moemi_ | WA | 0ms | 3608kb | C++20 | 1.6kb | 2024-10-07 16:06:53 | 2024-10-07 16:06:55 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>
#define sc_int(x) scanf("%d", &x)
#define x first
#define y second
#define pb push_back
using namespace std;
const int N = 5010, M = 10010, MOD = 1e9 + 7;
const int inf = 1e9;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;
LL n, m, k;
void solve()
{
cin >> n >> m;
vector<vector<int>> a(n);
for(int i = 0; i < n; i ++)
{
cin >> k;
while(k -- )
{
int x;
cin >> x;
a[i].pb(x);
}
sort(a[i].begin(), a[i].end());
a[i].erase(unique(a[i].begin(), a[i].end()), a[i].end());
}
map<int, int> mp;
for(auto t : a[0]) mp[t] = 1;
for(int i = 1; i < n; i ++)
{
bool flag = true;
for(auto t : a[i])
{
if(mp[t]) flag = false;
mp[t] = 1;
}
if(flag)
{
cout << "Yes" << endl;
cout << i + 1 << " ";
for(int j = 1; j <= n; j ++)
{
if(j - 1 != i) cout << j << " ";
}
cout << endl;
return;
}
}
cout << "No" << endl;
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T = 1;
cin >> T;
while(T --)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
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 3 1 2 No No
result:
ok OK. (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
1 10 5 2 2 4 4 1 3 4 2 1 2 3 2 1 4 4 5 2 4 3 3 2 5 4 3 5 4 2 3 1 3 2 5 1 4 2 3 5 1 4
output:
No
result:
wrong answer jury found an answer but participant did not (test case 1)