結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2021-02-17 00:23:48 |
| 言語 | Go (1.23.4) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,333 bytes |
| コンパイル時間 | 11,631 ms |
| コンパイル使用メモリ | 226,352 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 12:29:26 |
| 合計ジャッジ時間 | 12,623 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 16 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
var (
x uint32 = 0
y uint32 = 1
z uint32 = 2
w uint32 = 3
)
func xorshift() uint32 {
var t uint32 = x ^ (x << 11)
x = y
y = z
z = w
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))
return w
}
const (
totalSize = 10000001
buffSize = 10000
)
func main() {
defer flush()
x = uint32(readInt())
t := make([]int, 0, totalSize/10+1)
buff := make([]int, buffSize)
for i := 0; i < totalSize/buffSize; i++ {
for j := 0; j < buffSize; j++ {
buff[j] = int(xorshift())
}
sort.Ints(buff)
a := (buffSize - (buffSize / 10)) / 2
t = append(t, buff[a:a+buffSize/10]...)
}
t = append(t, int(xorshift()))
sort.Ints(t)
println(t[len(t)/2])
}
const (
ioBufferSize = 1 * 1024 * 1024 // 1 MB
)
var stdinScanner = func() *bufio.Scanner {
result := bufio.NewScanner(os.Stdin)
result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
result.Split(bufio.ScanWords)
return result
}()
func readString() string {
stdinScanner.Scan()
return stdinScanner.Text()
}
func readInt() int {
result, err := strconv.Atoi(readString())
if err != nil {
panic(err)
}
return result
}
var stdoutWriter = bufio.NewWriter(os.Stdout)
func flush() {
stdoutWriter.Flush()
}
func println(args ...interface{}) (int, error) {
return fmt.Fprintln(stdoutWriter, args...)
}
c-yan