-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
66 lines (57 loc) · 990 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var (
N int
C map[int]int = make(map[int]int)
)
func readVariables() {
N = nextInt()
}
func main() {
readVariables()
var answer bool
answer = true
for i := 0; i < N; i++ {
v := nextInt()
if C[v] > 0 {
answer = false
break
}
C[v]++
}
// fmt.Println(C)
if answer {
fmt.Println("YES")
} else {
fmt.Println("NO")
}
}
/* 以下、テンプレート*/
var scanner *bufio.Scanner
func init() {
scanner = bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
}
//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
if !scanner.Scan() {
panic("No more token.")
}
num, err := strconv.Atoi(scanner.Text())
if err != nil {
panic("nextInt(): cannot convert to int: " + scanner.Text())
}
return num
}
func nextStr() string {
if !scanner.Scan() {
panic("No more token.")
}
return scanner.Text()
}