QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#271061 | #7738. Equivalent Rewriting | The_Owls# | WA | 0ms | 3412kb | C++14 | 1.1kb | 2023-12-01 22:03:46 | 2023-12-01 22:03:47 |
Judging History
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();
}
}
详细
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)