Submission #3237742
Source Code Expand
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func main() {
NewReader(1000000000)
n := ReadInt()
tmpa := ReadInts64(" ")
tmpb := ReadInts64(" ")
var res int64
for bit := 1; bit < 30; bit++ {
var t int64 = 1 << uint32(bit)
a, b := make(BigInts, n), make(BigInts, n)
for i := range a {
a[i], b[i] = tmpa[i]%(2*t), tmpb[i]%(2*t)
}
sort.Sort(b)
c := 0
for _, aa := range a {
c1 := SearchBigInts(b, t-aa)
c2 := SearchBigInts(b, 2*t-aa)
c3 := SearchBigInts(b, 3*t-aa)
c4 := SearchBigInts(b, 4*t-aa)
c = (c + c2 - c1 + c4 - c3) % 2
}
if c == 1 {
res += t
}
}
fmt.Println(res)
}
type Reader struct {
rdr *bufio.Reader
size int
}
var reader *Reader
func NewReader(size int) {
reader = &Reader{
bufio.NewReaderSize(os.Stdin, size),
size,
}
}
func ReadLine() string {
buf := make([]byte, 0, reader.size)
for {
line, isPrefix, err := reader.rdr.ReadLine()
if err != nil {
panic(err)
}
buf = append(buf, line...)
if !isPrefix {
break
}
}
return string(buf)
}
func ReadInt() (n int) {
if i, e := strconv.Atoi(ReadLine()); e == nil {
n = i
}
return
}
func ReadStrs(sep string) []string {
return strings.Split(ReadLine(), sep)
}
func ReadInts64(sep string) []int64 {
a := ReadStrs(sep)
n := make([]int64, 0)
for _, v := range a {
if i, e := strconv.ParseInt(v, 10, 64); e == nil {
n = append(n, i)
}
}
return n
}
type BigInts []int64
func (a BigInts) Len() int {
return len(a)
}
func (a BigInts) Swap(i, j int) {
a[i], a[j] = a[j], a[i]
}
func (a BigInts) Less(i, j int) bool {
return a[i] < a[j]
}
func SearchBigInts(a []int64, x int64) int {
return sort.Search(len(a), func(i int) bool { return a[i] >= x })
}
Submission Info
Submission Time |
|
Task |
D - Two Sequences |
User |
icewaterGreentea |
Language |
Go (1.6) |
Score |
0 |
Code Size |
1857 Byte |
Status |
WA |
Exec Time |
3162 ms |
Memory |
2048256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
AC |
× 2 |
WA |
× 2 |
TLE |
× 6 |
MLE |
× 6 |
|
Set Name |
Test Cases |
Sample |
example_0, example_1, example_2, example_3 |
All |
N100000_0, N100000_1, N150000_0, N150000_1, N200000_0, N200000_1, N200000_ex_0, N200000_ex_1, example_0, example_1, example_2, example_3, rand_0, rand_1, smallrand_0, smallrand_1 |
Case Name |
Status |
Exec Time |
Memory |
N100000_0 |
WA |
2191 ms |
193664 KB |
N100000_1 |
AC |
2161 ms |
192128 KB |
N150000_0 |
TLE |
3160 ms |
217088 KB |
N150000_1 |
TLE |
3162 ms |
218368 KB |
N200000_0 |
TLE |
3162 ms |
225408 KB |
N200000_1 |
TLE |
3162 ms |
225408 KB |
N200000_ex_0 |
TLE |
3162 ms |
230400 KB |
N200000_ex_1 |
TLE |
3162 ms |
231680 KB |
example_0 |
MLE |
1152 ms |
2048128 KB |
example_1 |
MLE |
1138 ms |
2048128 KB |
example_2 |
MLE |
614 ms |
2048256 KB |
example_3 |
MLE |
273 ms |
1071744 KB |
rand_0 |
AC |
152 ms |
134912 KB |
rand_1 |
WA |
279 ms |
139136 KB |
smallrand_0 |
MLE |
589 ms |
2048128 KB |
smallrand_1 |
MLE |
270 ms |
1071872 KB |