QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#402884 | #7738. Equivalent Rewriting | ChongQY | WA | 43ms | 42612kb | Java8 | 4.6kb | 2024-05-01 17:12:37 | 2024-05-01 17:12:39 |
Judging History
answer
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static Read scanner = new Read(System.in);
public static final long MOD = (long) (1e9 + 7);
public static final int MID = (int) (3 * 1e5 + 7);
public static final long LMAX = Long.MAX_VALUE;
public static final long LMIN = Long.MIN_VALUE;
public static final int IMAX = Integer.MAX_VALUE;
public static final int IMIN = Integer.MIN_VALUE;
public static long[] arr = new long[MID];
// public static long[] Qz = new long[MID];
// public static long[] Hz = new long[MID];
public static int N, M , n , m;
public static long ans;
// public static boolean[][] stack = new boolean[MID][MID];
//四个方向
public static int[] row = {1, -1, 0, 0};
public static int[] cos = {0, 0, 1, -1};
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
public static void solve(){
// 1 3 2 0 2 3
// 1 3 2 0 2 3
int m = scanner.nextInt();// 操作次数
int n = scanner.nextInt();// 序列长度
HashSet<Integer> set = new HashSet<>();
int index = -1;
for(int i = 1 ; i <= m ; i++){
int w = scanner.nextInt();
if(set.isEmpty()){
for(int j = 1 ; j <= w ; j++){
int num = scanner.nextInt();
set.add(num);
}
} else {
boolean pool = true;
for(int j = 1 ; j <= w ; j++){
int num = scanner.nextInt();
if(set.contains(num)){
pool = false;
}
set.add(num);
}
if(pool){
index = i;
break;
}
}
}
if(index != -1){
System.out.println("Yes");
System.out.print(index + " ");
for(int i = 1 ; i <= m ; i++){
if(index == i) continue;
System.out.print(i + " ");
}
System.out.println();
} else {
System.out.println("No");
}
// 3 1 5
// 5
// 2 6
// 1
// 6 1
}
public static void main(String[] args) {
// long start = System.currentTimeMillis();//程序开始时间戳
int T = scanner.nextInt();
while (T-- != 0) {
solve();
}
out.flush();
// long end = System.currentTimeMillis();//程序结束时间戳
// out.println("运行时间 : " + (end - start));//输出运行时间
}
//快读
static class Read {
BufferedReader br;
StringTokenizer st;
public Read(InputStream in) {
br = new BufferedReader(new InputStreamReader(in), 16384);
eat("");
}
public void eat(String s) {
st = new StringTokenizer(s);
}
public String nextLine() {
try {
return br.readLine();
} catch (IOException e) {
return null;
}
}
public boolean hasNext() {
while (!st.hasMoreTokens()) {
String s = nextLine();
if (s == null)
return false;
eat(s);
}
return true;
}
public String next() {
hasNext();
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public Double nextDouble() {
return Double.parseDouble(next());
}
public BigInteger nextBigInteger() {
return new BigInteger(next());
}
public BigDecimal nextBigDecimal() {
return new BigDecimal(next());
}
}
public static void swap(long[] arr , int index1 , int index2){
long t = arr[index1];
arr[index1] = arr[index2];
arr[index2] = t;
}
public static long Dot_pitch(long x , long y , long xx , long yy){
return (xx - x) * (xx - x) + (yy - y) * (yy - y);
// return (long) Math.sqrt(Math.pow(xx - x , 2) + Math.pow(yy - y , 2));
}
}
class way {
public int x, y;
public way(int x, int y) {
this.x = x;
this.y = y;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 35ms
memory: 42612kb
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: 43ms
memory: 39260kb
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)