結果
問題 | No.702 中央値を求めよ LIMITED |
ユーザー |
![]() |
提出日時 | 2021-02-17 00:25:50 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,332 bytes |
コンパイル時間 | 14,264 ms |
コンパイル使用メモリ | 223,164 KB |
実行使用メモリ | 11,736 KB |
最終ジャッジ日時 | 2024-09-13 12:31:20 |
合計ジャッジ時間 | 32,379 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 25 |
ソースコード
package mainimport ("bufio""fmt""os""sort""strconv")var (x uint32 = 0y uint32 = 1z uint32 = 2w uint32 = 3)func xorshift() uint32 {var t uint32 = x ^ (x << 11)x = yy = zz = ww = (w ^ (w >> 19)) ^ (t ^ (t >> 8))return w}const (totalSize = 10000001buffSize = 1000)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)) / 2t = 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...)}