Пример #1
0
func parse(pr *codejam.Problem, testCaseIndex int) *data {
	d := &data{
		testIndex: testCaseIndex,
	}

	d.val = pr.ReadString()

	return d
}
Пример #2
0
func parse(pr *codejam.Problem, testCaseIndex int) *data {
	d := &data{
		testIndex: testCaseIndex,
	}

	nm := pr.ReadInts(nil)
	n := nm[0]
	m := nm[1]

	d.es = make([]string, n)
	d.ns = make([]string, m)

	for i := 0; i < n; i++ {
		d.es[i] = pr.ReadString()
	}

	for i := 0; i < m; i++ {
		d.ns[i] = pr.ReadString()
	}

	return d
}
Пример #3
0
func parse(pr *codejam.Problem, testCaseIndex int) *data {
	d := &data{
		testIndex: testCaseIndex,
	}

	n := pr.ReadInt()
	d.vertices = make([]string, n)
	d.edges = make([][]int, n)

	for i := 0; i < n; i++ {
		d.vertices[i] = pr.ReadString()
	}

	for i := 0; i < n-1; i++ {
		edge := pr.ReadInts(nil)
		a, b := edge[0]-1, edge[1]-1

		d.edges[a] = append(d.edges[a], b)
		d.edges[b] = append(d.edges[b], a)
	}

	return d
}
Пример #4
0
func parse(pr *codejam.Problem, testCaseIndex int) *data {
	d := &data{
		testIndex: testCaseIndex,
	}

	n := pr.ReadInt()

	d.m = make([][]byte, 2*n)

	for i := 0; i < 2*n; i++ {
		d.m[i] = make([]byte, 2*n)

		str := pr.ReadString()

		for j := 0; j < 2*n; j++ {
			if str[j] == '1' {
				d.m[i][j] = 1
			} else {
				d.m[i][j] = 0
			}
		}
	}
	return d
}