Skip to content

Commit

Permalink
Graph Based Problem 3
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotter0 committed Jan 24, 2018
1 parent 89779c8 commit 74713f8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CP/Codeforces Round #457 (Div. 2)/prob2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,36 @@
if k < len(a):
print 'No'
quit()
#print(a)
s = a[-1]
c = 0
while len(a) + c < k:
if a and s == a[-1]:
c += 1
a.pop()
#print(a)
c = c * 2
s -= 1
t = len(a) + c - k
a.reverse()
b = 0
#print(t,a,c,s)
if t:
while t:
c -= 2
t -= 1
b += 1
#print("loop1")
if not a:
c -= 1
a.append(s)
#print("loop2")
#print(c)
while c > 1:
c -= 2
b += 1
a.extend([a.pop() - 1] * 2)
#print("loop3")
a = [s + 1] * b + [s] * c + a
print 'Yes'
for x in a:
Expand Down
14 changes: 14 additions & 0 deletions CP/Codeforces Round #457 (Div. 2)/prob3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
n, m = map(int, raw_input().split())
t = k = 100000007
print 2, (k if n != 2 else 2)
print 1, n, 2
k -= 2
for i in range(2, n):
print 1, i, k / (n - 2) + (k % (n - 2) if i == 2 else 0)
u, v = 2, 2
for i in range(n - 1, m):
v += 1
if v > n:
u += 1
v = u + 1
print u, v, t
Empty file.

0 comments on commit 74713f8

Please sign in to comment.