Last active
October 22, 2021 07:38
-
-
Save ouuan/480179fcfa21cf4cb89247d69dfb33e9 to your computer and use it in GitHub Desktop.
将 namex-x.in 格式的数据改成 namex.in 格式的,输出 UOJ 格式的 subtask_end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ls *.in | sort -V | awk '{ | |
| begin = match($0, /-[0-9]*/) + 1; | |
| if (substr($0, begin, RLENGTH - 1) == "1") { | |
| if (subtask > 0) print "subtask_end_" subtask " " NR - 1 ; | |
| ++subtask; | |
| if (!getline line) print "subtask_end_" subtask " " NR; | |
| } | |
| }' | |
| ls *.in | sort -V | awk '{tmp = $0; gsub(/[0-9]*-[0-9]*/, NR); system("cp " tmp " " $0);}' | |
| ls *.out | sort -V | awk '{tmp = $0; gsub(/[0-9]*-[0-9]*/, NR); system("cp " tmp " " $0);}' | |
| ls *.ans | sort -V | awk '{tmp = $0; gsub(/[0-9]*-[0-9]*/, NR); system("cp " tmp " " $0);}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment