[codeforces 293]B. Distinct Paths 试题描述 You have a rectangular n × m-cell board. Some cells are already painted some of k colors. You need to paint each uncolored cell one of the k colors so that any path from the upper left square to the lower right…
[codeforces 293]A. Weird Game 试题描述 Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consist…
CF293B Distinct Paths 题意 给定一个\(n\times m\)的矩形色板,有kk种不同的颜料,有些格子已经填上了某种颜色,现在需要将其他格子也填上颜色,使得从左上角到右下角的任意路径经过的格子都不会出现两种及以上相同的颜色.路径只能沿着相邻的格子,且只能向下或者向右. 计算所有可能的方案,结果对 \(1000000007 (10^9 + 7)\) 输入及输出格式 输入格式 第一行,三个整数$ n, m, k (1 \le n, m \le 1000, 1 \le k \le…
B. Distinct Paths time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a rectangular n × m-cell board. Some cells are already painted some of k colors. You need to paint each uncolored…
Description You are given an undirected unweighted tree consisting of \(n\) vertices. An undirected tree is a connected undirected graph with \(n−1\) edges. Your task is to choose two pairs of vertices of this tree (all the chosen vertices should be…