Submission #5402761


Source Code Expand

package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

func main() {
  var n,m int = NextInts()
  var st []int = make([]int,m+2)
  var nn []int = make([]int,m+1)
  for i:=0;i<n;i++ {
    var l,r int = NextInts()
    st[l]++
    st[r+1]--
    for j:=1;j<m+1;j++ {
      nn[j] += (r-l)/j
    }
  }
  for i:=1;i<m+1;i++ { st[i] += st[i-1] }
  for i:=1;i<m+1;i++ {
    var t int = -nn[i]
    for j:=0;j<m+1;j+=i {
      t += st[j]
    }
    fmt.Println(t)
  }
}

var reader = bufio.NewReaderSize(os.Stdin,1000000)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}

Submission Info

Submission Time
Task E - Snuke Line
User ue1221
Language Go (1.6)
Score 0
Code Size 992 Byte
Status WA
Exec Time 2107 ms
Memory 5504 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 1
WA × 1
AC × 5
WA × 9
TLE × 25
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
All 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 1 ms 640 KB
00_example_02.txt WA 1 ms 640 KB
01.txt WA 1 ms 640 KB
02.txt WA 3 ms 768 KB
03.txt WA 2 ms 640 KB
04.txt AC 1 ms 640 KB
05.txt WA 3 ms 640 KB
06.txt WA 3 ms 640 KB
07.txt AC 1 ms 640 KB
08.txt WA 4 ms 640 KB
09.txt AC 2 ms 640 KB
10.txt WA 2 ms 640 KB
11.txt TLE 2107 ms 2560 KB
12.txt TLE 2107 ms 3328 KB
13.txt TLE 2107 ms 2944 KB
14.txt TLE 2104 ms 4864 KB
15.txt TLE 2107 ms 4864 KB
16.txt TLE 2107 ms 2432 KB
17.txt TLE 2107 ms 3200 KB
18.txt TLE 2107 ms 5504 KB
19.txt TLE 2107 ms 3328 KB
20.txt TLE 2107 ms 3328 KB
21.txt TLE 2107 ms 3328 KB
22.txt TLE 2107 ms 3328 KB
23.txt TLE 2107 ms 3328 KB
24.txt TLE 2107 ms 3200 KB
25.txt TLE 2107 ms 2688 KB
26.txt TLE 2107 ms 4480 KB
27.txt TLE 2107 ms 3328 KB
28.txt TLE 2107 ms 2688 KB
29.txt TLE 2107 ms 2944 KB
30.txt TLE 2107 ms 2688 KB
31.txt TLE 2107 ms 2560 KB
32.txt TLE 2107 ms 2560 KB
33.txt TLE 2107 ms 4224 KB
34.txt TLE 2107 ms 3200 KB
35.txt TLE 2107 ms 3328 KB
36.txt AC 1 ms 640 KB
37.txt WA 204 ms 3328 KB