예제 #1
0
파일: algorithm.py 프로젝트: hamax/avy
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========================================================================

import heapq
import sys

if len(sys.argv) > 1 and sys.argv[1] == 'avy':
	from avy import avy
else:
	def avy(*argv):
		pass

avy('start')

# Preberemo cel vhod (hitreje kot vsako vrstico posebej)
lines = sys.stdin.read().strip().split('\n')

# Iz vhoda razberemo n, m, z
n, m = map(int, lines[0].split())
z = int(lines[1])

# Za vsako prijateljico pripravimo seznam cest
pov = [[] for i in range(n)]
for line in lines[2:]:
	a, b, c = map(int, line.split())
	pov[b].append((a, c))
	avy('graph.addLink', b, a, {'value': c})
예제 #2
0
파일: algorithm.py 프로젝트: hamax/avy
# ========================================================================
# Copyright 2013 Ziga Ham
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========================================================================

import sys

if len(sys.argv) > 1 and sys.argv[1] == 'avy':
	from avy import avy
else:
	def avy(*argv):
		pass

avy('start') # Start a new avy file
list = []
for i in range(10):
	avy('step') # Step in the animation
	list.append(i)
	avy('list.add', i) # Tell avy that we added i to the list