Submission #3237724
Source Code Expand
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func main() {
NewReader(10 * 9)
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]%(int64(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 += (c2 - c1 + c4 - c3) % 2
}
res += int64(c%2) * 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 |
1849 Byte |
Status |
WA |
Exec Time |
3160 ms |
Memory |
18816 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
|
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 |
2135 ms |
10752 KB |
N100000_1 |
AC |
2140 ms |
12308 KB |
N150000_0 |
TLE |
3159 ms |
14612 KB |
N150000_1 |
TLE |
3156 ms |
12416 KB |
N200000_0 |
TLE |
3160 ms |
18816 KB |
N200000_1 |
TLE |
3160 ms |
17536 KB |
N200000_ex_0 |
TLE |
3160 ms |
17920 KB |
N200000_ex_1 |
TLE |
3156 ms |
17280 KB |
example_0 |
AC |
1 ms |
640 KB |
example_1 |
AC |
1 ms |
640 KB |
example_2 |
AC |
1 ms |
640 KB |
example_3 |
AC |
1 ms |
640 KB |
rand_0 |
AC |
108 ms |
4608 KB |
rand_1 |
WA |
236 ms |
5376 KB |
smallrand_0 |
AC |
1 ms |
640 KB |
smallrand_1 |
AC |
1 ms |
640 KB |