QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#271061#7738. Equivalent RewritingThe_Owls#WA 0ms3412kbC++141.1kb2023-12-01 22:03:462023-12-01 22:03:47

Judging History

你现在查看的是最新测评结果

  • [2023-12-01 22:03:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3412kb
  • [2023-12-01 22:03:46]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long int
#define loop(i,o,n,step) for(auto i{o}; i < n; i += step)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

bool check(vector<int> &a, vector<int> &b){
    loop(i,0,a.size(),1){
        if(binary_search(b.begin(), b.end(), a[i]))
            return false;
    }
    return true;
}

void solve(){
    int n, m;
    cin >> n >> m;
    vector<int> vec[n];
    int p[n]{};
    loop(i,0,n,1){
        cin >> p[i];
        loop(j, 0, p[i], 1){
            int tmp;
            cin >> tmp;
            vec[i].push_back(tmp);
        }
        sort(vec[i].begin(), vec[i].end());
    }
    loop(i,1,n,1){
        if(check(vec[i-1], vec[i])){
            cout << "Yes\n";
            loop(j, 0, i - 1, 1) cout << j + 1 << " ";
            cout << i+1 << " " << i << " ";
            loop(j, i + 1, n, 1) cout << j + 1 << (j != n - 1 ? " " : "");
            cout << "\n";
            return;
        }
    }
    cout << "No\n";
}

int main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3388kb

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
1 3 2 
No
No

result:

ok OK. (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3412kb

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)