Skip to content

Commit 8b46c53

Browse files
committed
use ellipsis in query
1 parent a794771 commit 8b46c53

File tree

1 file changed

+8
-3
lines changed
  • copypasta/template/interactive_problem

1 file changed

+8
-3
lines changed

copypasta/template/interactive_problem/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// github.com/EndlessCheng/codeforces-go
1010
type (
1111
initData struct{ n int }
12-
request struct{ i int }
12+
request struct{ q []int }
1313
response struct{ v int }
1414
answer struct{ ans []int }
1515
)
@@ -31,8 +31,13 @@ func (io io) readInitData() (d initData) {
3131
}
3232

3333
func (io io) query(q request) (resp response) {
34-
Fprintln(io.out, "?", q.i)
34+
Fprint(io.out, "?")
35+
for _, v := range q.q {
36+
Fprint(io.out, " ", v)
37+
}
38+
Fprintln(io.out)
3539
io.out.Flush()
40+
3641
Fscan(io.in, &resp.v)
3742
if resp.v < 0 {
3843
panic(-1)
@@ -57,7 +62,7 @@ func (io io) printAnswer(a answer) {
5762
}
5863

5964
func doInteraction(it interaction) {
60-
q := func(i int) int { return it.query(request{i}).v }
65+
q := func(q ...int) int { return it.query(request{q}).v }
6166
dt := it.readInitData()
6267
n := dt.n
6368
ans := make([]int, n) //

0 commit comments

Comments
 (0)