Submission #51587247
Source Code Expand
Copy
package mainimport ("bufio""fmt""os""strconv""strings")func main() {var n, k intfmt.Scanf("%d %d", &n, &k)sc := bufio.NewScanner(os.Stdin) // 標準入力を受け付けるスキャナsc.Scan() // 1行分の入力を取得するinputs := strings.Split(sc.Text(), " ") // 半角スペース区切りでstring型として配列inputsに格納// 配列inputsの中身をstring→intに変換してリストに格納var ps []int // Pnを格納する配列を宣言for _, input := range inputs { // 配列inputsの全ての要素について実行
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { var n, k int fmt.Scanf("%d %d", &n, &k) sc := bufio.NewScanner(os.Stdin) // 標準入力を受け付けるスキャナ sc.Scan() // 1行分の入力を取得する inputs := strings.Split(sc.Text(), " ") // 半角スペース区切りでstring型として配列inputsに格納 // 配列inputsの中身をstring→intに変換してリストに格納 var ps []int // Pnを格納する配列を宣言 for _, input := range inputs { // 配列inputsの全ての要素について実行 p, _ := strconv.Atoi(input) // string→intに型変換 ps = append(ps, p) // intに型変換した値を、Pnを格納する配列に追加 } m := make(map[int]bool) uniq := []int{} for _, ele := range ps { if !m[ele] { m[ele] = true uniq = append(uniq, ele) } } res := k * (k + 1) / 2 for _, v := range uniq { if v <= k { res = res - v } } fmt.Println(res) }
Submission Info
Submission Time | |
---|---|
Task | C - Σ |
User | mineel |
Language | Go (go 1.20.6) |
Score | 0 |
Code Size | 1083 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 1776 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 250 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 0 ms | 1652 KB |
00_sample_01.txt | AC | 0 ms | 1648 KB |
00_sample_02.txt | AC | 0 ms | 1676 KB |
01_random_00.txt | WA | 0 ms | 1776 KB |
01_random_01.txt | WA | 0 ms | 1776 KB |
01_random_02.txt | WA | 0 ms | 1776 KB |
01_random_03.txt | WA | 0 ms | 1772 KB |
01_random_04.txt | WA | 0 ms | 1772 KB |
01_random_05.txt | WA | 0 ms | 1776 KB |
01_random_06.txt | WA | 0 ms | 1772 KB |
01_random_07.txt | WA | 1 ms | 1776 KB |
01_random_08.txt | WA | 0 ms | 1776 KB |
01_random_09.txt | WA | 0 ms | 1776 KB |
01_random_10.txt | WA | 0 ms | 1772 KB |
01_random_11.txt | WA | 0 ms | 1776 KB |
02_random2_00.txt | AC | 0 ms | 1776 KB |
02_random2_01.txt | AC | 0 ms | 1776 KB |
02_random2_02.txt | AC | 0 ms | 1772 KB |
03_handmade_00.txt | WA | 0 ms | 1772 KB |
03_handmade_01.txt | AC | 0 ms | 1776 KB |
03_handmade_02.txt | WA | 1 ms | 1772 KB |
03_handmade_03.txt | AC | 0 ms | 1772 KB |