Submission #19548850
Source Code Expand
Copy
package main import ( "bufio" "fmt" "os" "strconv" ) func getNextString(scanner *bufio.Scanner) string { if !scanner.Scan() { panic("scan failed") } return scanner.Text() } func atoi(s string) int { x, _ := strconv.Atoi(s); return x } func getNextInt(scanner *bufio.Scanner) int { return atoi(getNextString(scanner)) } func atoi64(s string) int64 { x, _ := strconv.ParseInt(s, 10, 64); return x } func getNextInt64(scanner *bufio.Scanner) int64 { return atoi64(getNextString(scanner)) } func atof64(s string) float64 { x, _ := strconv.ParseFloat(s, 64); return x } func getNextFloat64(scanner *bufio.Scanner) float64 { return atof64(getNextString(scanner)) } func main() { fp := os.Stdin wfp := os.Stdout extra := 0 if os.Getenv("I") == "IronMan" { fp, _ = os.Open(os.Getenv("END_GAME")) extra = 100 } scanner := bufio.NewScanner(fp) scanner.Split(bufio.ScanWords) scanner.Buffer(make([]byte, 1000005), 1000005) writer := bufio.NewWriter(wfp) defer func() { r := recover() if r != nil { fmt.Fprintln(writer, r) } writer.Flush() }() solve(scanner, writer) for i := 0; i < extra; i++ { fmt.Fprintln(writer, "-----------------------------------") solve(scanner, writer) } } func solve(scanner *bufio.Scanner, writer *bufio.Writer) { h := 4 w := 4 g := makeGrid(h, w) for i := 0; i < h; i++ { for j := 0; j < w; j++ { g[i][j] = getNextInt(scanner) } } for i := 0; i < h; i++ { for j := 0; j < w-1; j++ { if g[i][j] == g[i][j+1] { fmt.Fprintln(writer, "CONTINUE") return } } } for i := 0; i < h-1; i++ { for j := 0; j < w; j++ { if g[i][j] == g[i+1][j] { fmt.Fprintln(writer, "CONTINUE") return } } } fmt.Fprintln(writer, "GAMEOVER") } func makeGrid(h, w int) [][]int { index := make([][]int, h, h) data := make([]int, h*w, h*w) for i := 0; i < h; i++ { index[i] = data[i*w : (i+1)*w] } return index }
Submission Info
Submission Time | |
---|---|
Task | A - DEAD END |
User | ccppjsrb |
Language | Go (1.14.1) |
Score | 100 |
Code Size | 2068 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 1816 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | hand_1.txt, hand_2.txt, random_1.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_2.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_3.txt, random_30.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, sample_1.txt, sample_2.txt, sample_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_1.txt | AC | 5 ms | 1816 KB |
hand_2.txt | AC | 2 ms | 1800 KB |
random_1.txt | AC | 2 ms | 1800 KB |
random_10.txt | AC | 2 ms | 1804 KB |
random_11.txt | AC | 2 ms | 1800 KB |
random_12.txt | AC | 2 ms | 1812 KB |
random_13.txt | AC | 2 ms | 1812 KB |
random_14.txt | AC | 2 ms | 1800 KB |
random_15.txt | AC | 2 ms | 1816 KB |
random_16.txt | AC | 2 ms | 1796 KB |
random_17.txt | AC | 3 ms | 1796 KB |
random_18.txt | AC | 2 ms | 1800 KB |
random_19.txt | AC | 2 ms | 1796 KB |
random_2.txt | AC | 2 ms | 1816 KB |
random_20.txt | AC | 2 ms | 1796 KB |
random_21.txt | AC | 3 ms | 1816 KB |
random_22.txt | AC | 2 ms | 1804 KB |
random_23.txt | AC | 2 ms | 1812 KB |
random_24.txt | AC | 2 ms | 1796 KB |
random_25.txt | AC | 2 ms | 1816 KB |
random_26.txt | AC | 2 ms | 1796 KB |
random_27.txt | AC | 2 ms | 1796 KB |
random_28.txt | AC | 2 ms | 1800 KB |
random_29.txt | AC | 2 ms | 1812 KB |
random_3.txt | AC | 2 ms | 1800 KB |
random_30.txt | AC | 4 ms | 1800 KB |
random_4.txt | AC | 2 ms | 1796 KB |
random_5.txt | AC | 2 ms | 1796 KB |
random_6.txt | AC | 2 ms | 1796 KB |
random_7.txt | AC | 2 ms | 1796 KB |
random_8.txt | AC | 2 ms | 1816 KB |
random_9.txt | AC | 2 ms | 1804 KB |
sample_1.txt | AC | 3 ms | 1800 KB |
sample_2.txt | AC | 2 ms | 1812 KB |
sample_3.txt | AC | 2 ms | 1800 KB |