Submission #11616167
Source Code Expand
package main import ( "bufio" "fmt" "os" "strconv" ) func out(x ...interface{}) { fmt.Println(x...) } var sc = bufio.NewScanner(os.Stdin) func getInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getString() string { sc.Scan() return sc.Text() } // min, max, asub, absなど基本関数 func max(a, b int) int { if a > b { return a } return b } func min(a, b int) int { if a < b { return a } return b } func asub(a, b int) int { if a > b { return a - b } return b - a } func abs(a int) int { if a >= 0 { return a } return -a } func main() { sc.Split(bufio.ScanWords) sc.Buffer([]byte{}, 1000000) s := getString() n := len(s) - 1 a1 := 0 a2 := 0 for i, v := range s { // out(i) x := 0 y := 0 if v == 'U' { x += n - i y += i } else { y += n - i x += i } a1 += x a2 += y // out(x, y, a1, a2) } out(a1 + a2*2) }
Submission Info
Submission Time | |
---|---|
Task | B - Evilator |
User | Aruaru0 |
Language | Go (1.6) |
Score | 400 |
Code Size | 1020 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 896 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 6 ms | 896 KB |
02.txt | AC | 6 ms | 896 KB |
03.txt | AC | 6 ms | 896 KB |
04.txt | AC | 6 ms | 896 KB |
05.txt | AC | 6 ms | 896 KB |
06.txt | AC | 6 ms | 896 KB |
07.txt | AC | 6 ms | 896 KB |
08.txt | AC | 6 ms | 896 KB |
09.txt | AC | 1 ms | 640 KB |
10.txt | AC | 1 ms | 640 KB |
s1.txt | AC | 1 ms | 640 KB |
s2.txt | AC | 1 ms | 640 KB |