File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env lua
2
+
3
+ if arg [1 ] == nil or arg [1 ] == " --help" or arg [1 ] == " -h" then
4
+ io.stderr :write (string.format (" %s <contest-name>\n " , arg [0 ]))
5
+ os.exit (1 )
6
+ end
7
+
8
+ local name = arg [1 ]
9
+
10
+ os.execute (" mkdir " .. name ) -- Ignore error
11
+
12
+ local filename = name .. " /Main.hs"
13
+ local fh = io.open (filename , " r" )
14
+ if fh then
15
+ fh :close ()
16
+ io.stderr :write (string.format (" %s already exists.\n " , filename ))
17
+ os.exit (1 )
18
+ end
19
+ fh = assert (io.open (filename , " w" ))
20
+ fh :write ([[
21
+ {-# LANGUAGE ScopedTypeVariables #-}
22
+ {-# LANGUAGE BangPatterns #-}
23
+ import Data.Char
24
+ import Data.Int
25
+ import Data.List
26
+ import Control.Monad
27
+ import qualified Data.Vector.Unboxed as U
28
+ import qualified Data.Vector.Unboxed.Mutable as UM
29
+ import qualified Data.ByteString.Char8 as BS
30
+
31
+ main = do
32
+ _ :: [Int] <- map (read . BS.unpack) . BS.words <$> BS.getLine
33
+ [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
34
+ edges <- U.replicateM m $ do
35
+ [x,y,z] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
36
+ return (x-1,y-1,z)
37
+ return ()
38
+ ]] )
39
+ fh :close ()
You can’t perform that action at this time.
0 commit comments