Submission #62094016
Source Code Expand
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class Main {
static long arr[] = null;
static HashSet<Long> hash = new HashSet<>();
static HashSet<String> hashCheck = new HashSet<>();
static void solve(int index) {
if (arr[index] == 0) {
return;
}
String mask = "";
long k = 0;
for (int i = 0; i < arr.length; i++) {
k ^= arr[i];
// mask += arr[i] + ",";
}
hash.add(k);
// if (hashCheck.contains(mask)) {
// return;
// }
// hashCheck.add(mask);
long temp = arr[index];
for (int i = index + 1; i < arr.length; i++) {
if (temp == 0 || arr[i] == 0) {
continue;
}
arr[i] += temp;
arr[index] = 0;
for (int o = 0; o < arr.length; o++) {
solve(o);
}
arr[i] -= temp;
arr[index] = temp;
}
}
public static void main(String[] args) throws java.lang.Exception {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
String mask = "";
arr = new long[n];
for (int i = 0; i < n; i++) {
long k = s.nextLong();
arr[i] = k;
mask += k + ",";
}
// solve(0);
for (int i = 0; i < n; i++) {
// hashCheck = new HashSet<>();
hashCheck.remove(mask);
solve(i);
}
// System.out.println(mask);
System.out.println(hash.size());
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Stone XOR |
| User | Reuben9027 |
| Language | Java (OpenJDK 17) |
| Score | 0 |
| Code Size | 1673 Byte |
| Status | TLE |
| Exec Time | 3316 ms |
| Memory | 62460 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 400 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 91 ms | 40420 KiB |
| example_01.txt | AC | 91 ms | 40444 KiB |
| example_02.txt | AC | 115 ms | 41336 KiB |
| hand_00.txt | TLE | 3313 ms | 60280 KiB |
| hand_01.txt | TLE | 3313 ms | 60748 KiB |
| hand_02.txt | TLE | 3313 ms | 59648 KiB |
| hand_03.txt | TLE | 3313 ms | 61288 KiB |
| hand_04.txt | AC | 89 ms | 40212 KiB |
| hand_05.txt | TLE | 3313 ms | 60488 KiB |
| random_00.txt | TLE | 3316 ms | 60976 KiB |
| random_01.txt | AC | 95 ms | 40228 KiB |
| random_02.txt | AC | 94 ms | 40328 KiB |
| random_03.txt | AC | 258 ms | 59368 KiB |
| random_04.txt | TLE | 3313 ms | 60512 KiB |
| random_05.txt | TLE | 3313 ms | 59928 KiB |
| random_06.txt | TLE | 3313 ms | 59632 KiB |
| random_07.txt | AC | 91 ms | 40432 KiB |
| random_08.txt | TLE | 3316 ms | 59696 KiB |
| random_09.txt | TLE | 3313 ms | 59876 KiB |
| random_10.txt | TLE | 3313 ms | 60444 KiB |
| random_11.txt | TLE | 3313 ms | 62460 KiB |
| random_12.txt | TLE | 3313 ms | 60164 KiB |
| random_13.txt | TLE | 3313 ms | 60232 KiB |
| random_14.txt | TLE | 3313 ms | 60544 KiB |
| random_15.txt | TLE | 3313 ms | 60680 KiB |
| random_16.txt | TLE | 3313 ms | 61344 KiB |
| random_17.txt | TLE | 3313 ms | 60616 KiB |
| random_18.txt | TLE | 3313 ms | 60912 KiB |
| random_19.txt | AC | 94 ms | 40296 KiB |
| random_20.txt | AC | 117 ms | 41476 KiB |
| random_21.txt | TLE | 3313 ms | 62048 KiB |
| random_22.txt | TLE | 3313 ms | 60224 KiB |
| random_23.txt | AC | 90 ms | 40160 KiB |
| random_24.txt | TLE | 3313 ms | 61464 KiB |
| random_25.txt | TLE | 3313 ms | 59860 KiB |
| random_26.txt | AC | 143 ms | 47936 KiB |
| random_27.txt | TLE | 3313 ms | 59820 KiB |
| random_28.txt | TLE | 3313 ms | 59848 KiB |
| random_29.txt | TLE | 3313 ms | 59688 KiB |