SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. object Main {
  2.  
  3.     private val out: PrintWriter =
  4.         PrintWriter(BufferedWriter(OutputStreamWriter(System.out, "UTF-8"), 512))
  5.  
  6.     @JvmStatic
  7.     fun main(args: Array<String>) {
  8.         val bufferReader = BufferedReader(InputStreamReader(FileInputStream(File("f_big.in"))))
  9.         val stringTokenizer = StringTokenizer(bufferReader.readLine())
  10.  
  11.         val nodes = HashMap<String, Node>()
  12.  
  13.         val files = parseLong(stringTokenizer.nextToken())
  14.         val targets = parseLong(stringTokenizer.nextToken())
  15.         val servers = parseLong(stringTokenizer.nextToken())
  16.  
  17.         for (i in 0 until files) {
  18.             val stringTokenizer = StringTokenizer(bufferReader.readLine())
  19.             val name = stringTokenizer.nextToken()
  20.             val compilation = parseLong(stringTokenizer.nextToken())
  21.             val replication = parseLong(stringTokenizer.nextToken())
  22.  
  23.             val dependencies = mutableListOf<Node>()
  24.             val depsTokenizer = StringTokenizer(bufferReader.readLine())
  25.             val depNum = parseLong(depsTokenizer.nextToken())
  26.             for (j in 0 until depNum) {
  27.                 val depName = depsTokenizer.nextToken()
  28.                 val dependency = nodes[depName]!!
  29.                 dependencies.add(dependency)
  30.             }
  31.  
  32.             val node = Node(
  33.                 name = name,
  34.                 compilation = compilation,
  35.                 replication = replication,
  36.                 dependencies = dependencies
  37.             )
  38.             nodes[name] = node
  39.         }
  40.  
  41.         val goals = mutableListOf<Target>()
  42.         for (i in 0 until targets) {
  43.             val stringTokenizer = StringTokenizer(bufferReader.readLine())
  44.             val name = stringTokenizer.nextToken()
  45.             val deadline = parseLong(stringTokenizer.nextToken())
  46.             val goal = parseLong(stringTokenizer.nextToken())
  47.  
  48.             val target = Target(
  49.                 name = name,
  50.                 deadline = deadline,
  51.                 goal = goal
  52.             )
  53.             goals.add(target)
  54.         }
  55.  
  56. //        out.println(nodes)
  57. //        out.println(goals)
  58. //        out.println(servers)
  59.  
  60.         out.flush()
  61.     }
  62.  
  63.     data class Node(
  64.         val name: String?,
  65.         val compilation: Long,
  66.         val replication: Long,
  67.         val dependencies: List<Node>
  68.     )
  69.  
  70.     data class Target(
  71.         val name: String,
  72.         val deadline: Long,
  73.         val goal: Long
  74.     )
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top