blob: 1a63e7211eec18fb68633b19b9155262c9c9cb3b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
const { _, performance } = require("perf_hooks");
const fs = require("fs");
function solve() {
n=[],m=[],t=[];
fs.readFileSync("input", "utf8").split("in").map(b=>b.split("\n")).slice(1).forEach((b,i)=>{if(b[4][6]=='1')t.push([i,+b[15].split(" ").slice(-1)[0]]);else{[j,x]=t.pop();d=x+ +b[5].split(" ").slice(-1)[0];if(d<0)[i,j,d]=[j,i,-d];m[i]=9;m[j]=9-d;n[i]=1+d;n[j]=1}})
console.log(m.join(""),n.join(""));
}
const tic = performance.now();
solve();
const toc = performance.now();
console.log("TIME: " + ((toc - tic) / 1000).toFixed(6) + " seconds");
|