File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ )
8
+
9
+ // github.com/EndlessCheng/codeforces-go
10
+ func CF330B (_r io.Reader , _w io.Writer ) {
11
+ in := bufio .NewReader (_r )
12
+ out := bufio .NewWriter (_w )
13
+ defer out .Flush ()
14
+
15
+ var n , m , v int
16
+ Fscan (in , & n , & m )
17
+ vis := make ([]bool , n + 1 )
18
+ for m *= 2 ; m > 0 ; m -- {
19
+ Fscan (in , & v )
20
+ vis [v ] = true
21
+ }
22
+ rt := 1
23
+ for ; vis [rt ]; rt ++ {
24
+ }
25
+ Fprintln (out , n - 1 )
26
+ for i := 1 ; i <= n ; i ++ {
27
+ if i != rt {
28
+ Fprintln (out , rt , i )
29
+ }
30
+ }
31
+ }
32
+
33
+ //func main() { CF330B(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/330/B
9
+ // https://codeforces.com/problemset/status/330/problem/B
10
+ func TestCF330B (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 4 1
15
+ 1 3
16
+ outputCopy
17
+ 3
18
+ 1 2
19
+ 4 2
20
+ 2 3`
21
+ testutil .AssertEqualCase (t , rawText , 0 , CF330B )
22
+ }
You can’t perform that action at this time.
0 commit comments