class AgentsTask(Task): id = 'agents' tests = [ Test(id='01', time=1.0, score=5.0, dat=None, chk=None), Test(id='02', time=1.0, score=5.0, dat=None, chk=None), Test(id='03', time=1.0, score=5.0, dat=None, chk=None), Test(id='04', time=1.0, score=5.0, dat=None, chk=None), Test(id='05', time=1.0, score=5.0, dat=None, chk=None), Test(id='06', time=1.0, score=5.0, dat=None, chk=None), Test(id='07', time=1.0, score=5.0, dat=None, chk=None), Test(id='08', time=1.0, score=5.0, dat=None, chk=None), Test(id='09', time=1.0, score=5.0, dat=None, chk=None), Test(id='10', time=1.0, score=5.0, dat=None, chk=None), Test(id='11', time=1.0, score=5.0, dat=None, chk=None), Test(id='12', time=1.0, score=5.0, dat=None, chk=None), Test(id='13', time=1.0, score=5.0, dat=None, chk=None), Test(id='14', time=1.0, score=5.0, dat=None, chk=None), Test(id='15', time=1.0, score=5.0, dat=None, chk=None), Test(id='16', time=1.0, score=5.0, dat=None, chk=None), Test(id='17', time=1.0, score=5.0, dat=None, chk=None), Test(id='18', time=1.0, score=5.0, dat=None, chk=None), Test(id='19', time=1.0, score=5.0, dat=None, chk=None), Test(id='20', time=1.0, score=5.0, dat=None, chk=None), ] eps = 1.0e-5 def load_dat(self, stream): N = self.read(stream, int) points = [] for k in range(N): points.append(self.read(stream, float, float)) M = self.read(stream, int) graph = [] for k in range(M): graph.append(self.read(stream, int)) return Dat(points=points, graph=graph) def load_chk(self, stream): return Chk(X=self.read(stream, float)) def save_dat(self, stream, dat): self.write(stream, len(dat.points)) for x, y in dat.points: self.write(stream, repr(x), repr(y)) self.write(stream, len(dat.graph)) for k in dat.graph: self.write(stream, k) def load_sol(self, stream): return Sol(X=self.read(stream, float)) def verify(self, dat, chk, sol): if abs(chk.X-sol.X) > self.eps: raise Break, 'WA' raise Break, 'OK'