7位を取りました。とても嬉しい。

## 本戦前

ある人と「どちらかが優勝したら相手に焼き肉を奢る」という約束をした。 懇親会のときに聞いたら、焼き肉食べれるのではとかなり期待していた、とのことであった。

``````info = query_getinfo()
worker_ids = []
for worker in info['workers']:
if worker['time'] == 0:
worker_ids.append(worker['id'])
``````

ランキングを見てたら点数が減っていて驚く。 問題文をよく見たら30分ごとに半減とあった。 この感じだとやはり後は順位下がる一方だなあ、という思いで問題文を読みなおしていた。

``````info = query_getinfo()
for worker in info['workers']:
print(worker)
out = query_getout()

if len(info['tasks']) == 0 and len(info['outsources']) == 0:
continue
for lim in [9,8,7]:
worker_ids = []
for worker in info['workers']:
if worker['time'] == 0:
worker_ids.append(worker['id'])
if len(worker_ids) == 0:
continue
if result is not None:
sys.exit(0)
else:
wait(0.05)

workable = 0
for worker in info['workers']:
if worker['time'] == 0:
workable += 1
if workable < 10 and len(info['tasks']) == 0 and len(info['outsources']) == 0:
print('zzz...')
sys.exit(0)

else:

for lim in [9,8,7,6,5,4,3,2,1]:
worker_ids = []
for worker in info['workers']:
if worker['time'] == 0:
worker_ids.append(worker['id'])
if len(worker_ids) == 0:
continue
if result is not None:
break
else:
wait(0.05)
else:
print('fail')
``````

``````#!/usr/bin/env python3
import urllib.request
import time
import os
import random
import json
import sys
import traceback
import math
import argparse

from common import *

info = query_getinfo()
print('id\ttime\texp\tspeed')
for worker in info['workers']:
print('{}\t{}\t{}\t{}'.format(worker['id'], worker['time'], worker['exp'], ' '.join(map(lambda x: str(x).rjust(2), worker['speed']))))

out = query_getout()

workable = 0
for worker in info['workers']:
if worker['time'] == 0:
workable += 1

if workable > 2:

for lim in [9,8,7,6,5]:
worker_ids = []
for worker in info['workers']:
if worker['time'] == 0:
worker_ids.append(worker['id'])
if len(worker_ids) == 0:
continue
if result is not None:
sys.exit(0)

continue
for lim in [9,8,7,6,5]:
worker_ids = []
for worker in info['workers']:
if worker['time'] == 0:
worker_ids.append(worker['id'])
if len(worker_ids) == 0:
continue
if result is not None:
sys.exit(0)
``````
``````import json
import os
import random
import sys
import time
import traceback
import urllib.request

def urlopen(url): #=> str or None
try:
res = urllib.request.urlopen(url, timeout=1)
except Exception:
traceback.print_exc()
else:

def query(t,u=''): #=> str or None
url = 'https://game.coderunner.jp/{}?token={}{}'.format(t,token,u)
print(url)
result = urlopen(url)
# print(result)
return result

def wait(sec=1.0):
time.sleep(sec)

with open('token') as fh:

def query_getinfo():
result = query('getinfoJson')
print(result)
return result # str
print(result)
return result # str
def query_getout():
result = query('getoutJson')
def query_change(workers):
result = query('change', '&worker={}'.format(','.join(map(str,workers))))
``````

## 要望

アンケート用紙に書き忘れたやつです。