feat(runner): compile Go and check answers per test group
This commit is contained in:
1 parent
e95c681165
commit
afee564bf4
61 files changed
+2592
-143
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
var target int
|
||||
if _, err := fmt.Fscan(reader, &target); err != nil {
|
||||
os.Exit(2)
|
||||
}
|
||||
seen := map[int]int{}
|
||||
scanner := bufio.NewScanner(reader)
|
||||
scanner.Split(bufio.ScanWords)
|
||||
for position := 1; scanner.Scan(); position++ {
|
||||
value, err := strconv.Atoi(scanner.Text())
|
||||
if err != nil {
|
||||
os.Exit(2)
|
||||
}
|
||||
if first, ok := seen[target-value]; ok {
|
||||
fmt.Println(first, position)
|
||||
return
|
||||
}
|
||||
if _, ok := seen[value]; !ok {
|
||||
seen[value] = position
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user