0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

yukicoder contest 283 参戦記

Posted at

yukicoder contest 283 参戦記

B 1399 すごろくで世界旅行 (構築)

D=1 のときは全ての頂点同士を行き来できるようにしないといけないが、それ以外であれば中継点を一つ決めて底と全ての頂点を行き来できるようにすればいい. 開始頂点から1に行き、1から1に行くを繰り返し、1から終了頂点に行くといった感じになる.

V, D = map(int, input().split())

t = [[0] * V for _ in range(V)]
if D == 1:
    t = [[1] * V for _ in range(V)]
else:
    for i in range(V):
        t[0][i] = 1
        t[i][0] = 1
for i in range(V):
    print(*t[i], sep='')
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?