├── database ├── deleted_problems.json ├── reviewed_database.json ├── user_database.json └── problem_gave_database.json ├── problem_set ├── Math │ ├── Gauss.txt │ ├── FFT.txt │ ├── Number_theory.txt │ └── combination_probability.txt ├── Graph │ ├── 2sat.txt │ ├── Euler_tour.txt │ ├── DFS_BFS_set2.txt │ ├── LCA.txt │ ├── Shortest_path_set2.txt │ ├── Matching.txt │ ├── MST_DSU.txt │ ├── Flow.txt │ ├── DFS_BFS_set1.txt │ ├── Shortest_path_set1.txt │ ├── DFS_BFS.txt │ └── Shortest_path.txt ├── DS │ ├── Heap.txt │ ├── HLD.txt │ ├── prefix_sum.txt │ ├── BBST.txt │ ├── Deque_stack.txt │ ├── IT_BIT_set2.txt │ ├── IT_BIT_set1.txt │ └── IT_BIT.txt ├── VOI │ ├── 2010.txt │ ├── 2009.txt │ ├── 2007.txt │ ├── 2008.txt │ ├── 2005.txt │ ├── 2012.txt │ ├── 2013.txt │ ├── 2014.txt │ ├── 2011.txt │ ├── 2016.txt │ ├── 2015.txt │ └── 2006.txt ├── Other │ ├── Greedy.txt │ ├── Sweep_line.txt │ ├── Compress.txt │ ├── 2_pointers.txt │ ├── matrix_multiplication.txt │ ├── DnC.txt │ ├── Brute_force.txt │ ├── Game_theory.txt │ ├── Bignum.txt │ └── Binary_ternary_search.txt ├── Geometry │ ├── Convexhull.txt │ ├── Geometry_set2.txt │ ├── Geometry_set1.txt │ └── Geometry.txt ├── String │ ├── SA.txt │ ├── Trie.txt │ └── KMP_Z_Hash.txt ├── DP │ ├── Digit.txt │ ├── Optimization.txt │ ├── Bitmask.txt │ ├── Tree.txt │ ├── Lexicographical.txt │ ├── DP_set4.txt │ ├── DP_set1.txt │ ├── DP_set2.txt │ ├── DP_set3.txt │ └── DP.txt ├── VO │ ├── 2012.txt │ ├── 2015.txt │ ├── 2016.txt │ ├── 2013.txt │ ├── 2017.txt │ └── 2014.txt ├── new.txt ├── OI │ ├── OI_notag_set28.txt │ ├── OI_notag_set12.txt │ ├── OI_notag_set14.txt │ ├── OI_notag_set11.txt │ ├── OI_notag_set17.txt │ ├── OI_notag_set01.txt │ ├── OI_notag_set02.txt │ ├── OI_notag_set03.txt │ ├── OI_notag_set10.txt │ ├── OI_notag_set13.txt │ ├── OI_notag_set15.txt │ ├── OI_notag_set16.txt │ ├── OI_notag_set20.txt │ ├── OI_notag_set22.txt │ ├── OI_notag_set23.txt │ ├── OI_notag_set24.txt │ ├── OI_set26.txt │ ├── OI_notag_set04.txt │ ├── OI_notag_set06.txt │ ├── OI_notag_set07.txt │ ├── OI_notag_set08.txt │ ├── OI_notag_set09.txt │ ├── OI_notag_set18.txt │ ├── OI_notag_set21.txt │ ├── OI_notag_set25.txt │ ├── OI_notag_set26.txt │ ├── OI_notag_set05.txt │ ├── OI_notag_set19.txt │ ├── OI_notag_set27.txt │ ├── OI_set08.txt │ ├── OI_set09.txt │ ├── OI_set10.txt │ ├── OI_set11.txt │ ├── OI_set17.txt │ ├── OI_set02.txt │ ├── OI_set16.txt │ ├── OI_set05.txt │ ├── OI_set06.txt │ ├── OI_set07.txt │ ├── OI_set13.txt │ ├── OI_set14.txt │ ├── OI_set01.txt │ ├── OI_set12.txt │ ├── OI_set18.txt │ ├── OI_set19.txt │ ├── OI_set22.txt │ ├── OI_set04.txt │ ├── OI_set25.txt │ ├── OI_set03.txt │ ├── OI_set20.txt │ ├── OI_set24.txt │ ├── OI_set15.txt │ ├── OI_set21.txt │ └── OI_set23.txt ├── ACM │ ├── ACM_notag_set04.txt │ ├── ACM_notag_set17.txt │ ├── ACM_notag_set01.txt │ ├── ACM_notag_set03.txt │ ├── ACM_notag_set14.txt │ ├── ACM_notag_set02.txt │ ├── ACM_notag_set05.txt │ ├── ACM_notag_set06.txt │ ├── ACM_notag_set11.txt │ ├── ACM_notag_set13.txt │ ├── ACM_notag_set07.txt │ ├── ACM_notag_set08.txt │ ├── ACM_notag_set10.txt │ ├── ACM_notag_set12.txt │ ├── ACM_notag_set15.txt │ ├── ACM_notag_set16.txt │ ├── ACM_notag_set09.txt │ ├── ACM_set18.txt │ ├── ACM_set05.txt │ ├── ACM_set01.txt │ ├── ACM_set03.txt │ ├── ACM_set04.txt │ ├── ACM_set15.txt │ ├── ACM_set02.txt │ ├── ACM_set07.txt │ ├── ACM_set16.txt │ ├── ACM_set12.txt │ ├── ACM_set13.txt │ ├── ACM_set06.txt │ ├── ACM_set14.txt │ ├── ACM_set08.txt │ ├── ACM_set10.txt │ ├── ACM_set11.txt │ ├── ACM_set17.txt │ └── ACM_set09.txt ├── VM │ ├── 2009.txt │ ├── 2011.txt │ ├── 2010.txt │ ├── 2015.txt │ ├── 2014.txt │ ├── 2013.txt │ └── 2012.txt ├── Tutorial_set_02.txt ├── Challenge.txt ├── Ad_hoc.txt ├── Tutorial_set_01.txt └── hidden.txt ├── requirements.txt ├── .gitattributes ├── statement_resources ├── CAR.rar ├── ENET.rar ├── GOLD.rar ├── XOR.rar ├── liq.zip ├── Circuit.pdf ├── VMCOUNT.zip ├── VMVSOS.zip ├── cheat.zip ├── floyd.rar ├── ptree.rar ├── MILITARY.rar ├── Triagles.pdf ├── Triminos.pdf ├── DH-2020-10.pdf ├── DH-2020-11.pdf ├── PreVNOI2013A.pdf ├── PreVNOI2013B.pdf └── VMSHAPE_sample_test.zip ├── .gitignore ├── .env-example ├── checker ├── NKPALIN-11268.cpp ├── CON-3989.cpp ├── VMCOUNT-8470.cpp ├── GLOVES-3714.cpp ├── GLOVE-11728.cpp ├── NKMINES-11355.cpp ├── VMTILE-6968.cpp ├── VMHEARTS-10845.cpp ├── SLIKAR-3816.cpp ├── NKONEARC-11380.cpp ├── TRAVEL12-6476.cpp ├── VODONCAY-12481.cpp ├── V8SCORE-11353.cpp ├── NKPOS-11354.cpp ├── NKTARDY-11378.cpp ├── VM3PHIA-5978.cpp ├── PCYCLE-3369.cpp ├── KBOMB-5980.cpp ├── VMMTFIVE-5972.cpp ├── INFORMAC-7629.cpp ├── VMKREIS-10927.cpp ├── NKNET-11379.cpp ├── PETROLM-11082.cpp ├── VOBOARD3-9853.cpp ├── HEADTAIL-6262.cpp ├── VM15SWAP-12256.cpp ├── NKTRIO-4019.cpp ├── TORCH-3402.cpp ├── WIFI-3406.cpp ├── IDCODE-12493.cpp ├── VMSUDOKU-10815.cpp ├── VMGAME-6974.cpp ├── MEXICO-13434.cpp ├── VMGROUP2-12284.cpp ├── VMCIRCLE-12314.cpp ├── VM10HNTW-4936.cpp ├── VMREL6-10633.cpp ├── VMLP-6709.cpp ├── VOBOARD-7663.cpp ├── TOUR2509-4965.cpp ├── VMCOINS-8638.cpp ├── VMDOM2-8621.cpp ├── VMST-10728.cpp ├── BPAINT-4915.cpp ├── UPBOUND-11078.cpp ├── VOSTRAVL-11079.cpp ├── RELBOARD-4049.cpp ├── VMCUT-12148.cpp ├── VMAOCE-8447.cpp ├── VODIVIDE-11445.cpp ├── CINEMA-11444.cpp ├── BALLGMVN-9958.cpp ├── VMXGAME-6858.cpp ├── GRAPH-11908.cpp ├── VMCROSS-10876.cpp ├── VMSQ-6796.cpp ├── VMPHQUA-10849.cpp ├── C11BC0-6039.pas ├── MAKHOA2-5959.cpp ├── VMMAZE-6902.cpp └── VMFLOW-8554.cpp ├── main.py ├── helper ├── helper.py ├── problem_set_helper.py ├── table.py ├── database.py └── paginator.py ├── README.md ├── cogs └── BotControlCommand.py └── services └── Polygon.py /database/deleted_problems.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /database/reviewed_database.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /database/user_database.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /database/problem_gave_database.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /problem_set/Math/Gauss.txt: -------------------------------------------------------------------------------- 1 | Khử Gauss 2 | GS 3 | -------------------------------------------------------------------------------- /problem_set/Graph/2sat.txt: -------------------------------------------------------------------------------- 1 | 2-satisfiability 2 | TWOSAT 3 | ELECT 4 | -------------------------------------------------------------------------------- /problem_set/Math/FFT.txt: -------------------------------------------------------------------------------- 1 | Fast Fourier Transform (FFT) 2 | POST2 3 | -------------------------------------------------------------------------------- /problem_set/DS/Heap.txt: -------------------------------------------------------------------------------- 1 | Cây Heap 2 | MEDIAN 3 | KMIN 4 | QBHEAP 5 | HEAP1 -------------------------------------------------------------------------------- /problem_set/VOI/2010.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2010 2 | LNACS 3 | STABLE 4 | TAXID -------------------------------------------------------------------------------- /problem_set/DS/HLD.txt: -------------------------------------------------------------------------------- 1 | Heavy Light Decomposition 2 | QTREEX 3 | QTREE3 4 | -------------------------------------------------------------------------------- /problem_set/Graph/Euler_tour.txt: -------------------------------------------------------------------------------- 1 | Chu trình Euler 2 | TOUR2509 3 | PCYCLE 4 | -------------------------------------------------------------------------------- /problem_set/VOI/2009.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2009 2 | LINEGAME 3 | STNODE 4 | PAGODA -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | python-dotenv 3 | discord 4 | asyncio 5 | pytz -------------------------------------------------------------------------------- /problem_set/Other/Greedy.txt: -------------------------------------------------------------------------------- 1 | Tham lam 2 | CAR 3 | KDEL 4 | KANDP 5 | MPILOT 6 | -------------------------------------------------------------------------------- /problem_set/VOI/2007.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2007 2 | QBMSEQ 3 | QBMARKET 4 | QBROBOT 5 | -------------------------------------------------------------------------------- /problem_set/VOI/2008.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2008 2 | NKSGAME 3 | NKJUMP 4 | NKGIFTS 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /problem_set/Other/Sweep_line.txt: -------------------------------------------------------------------------------- 1 | Sweep line 2 | TRIANGLE 3 | PLAHTE 4 | KINGDOMS 5 | -------------------------------------------------------------------------------- /problem_set/DS/prefix_sum.txt: -------------------------------------------------------------------------------- 1 | Tổng cộng dồn 2 | MAJMUN 3 | NKSEQ 4 | VBOARD 5 | MAXCUB 6 | -------------------------------------------------------------------------------- /problem_set/VOI/2005.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2005 2 | QBSEGPAR 3 | QBFIREWK 4 | COLLECT 5 | STEEL -------------------------------------------------------------------------------- /problem_set/Geometry/Convexhull.txt: -------------------------------------------------------------------------------- 1 | Bao lồi 2 | MILITARY 3 | HEADQRT 4 | MTRIAREA 5 | KMIX 6 | -------------------------------------------------------------------------------- /problem_set/String/SA.txt: -------------------------------------------------------------------------------- 1 | Suffix Array - Suffix Automaton - Suffix Tree 2 | DTCSTR 3 | DBRACKET 4 | -------------------------------------------------------------------------------- /problem_set/String/Trie.txt: -------------------------------------------------------------------------------- 1 | Cây Trie 2 | PALINX 3 | NPR 4 | NKSEV 5 | SEC 6 | CHAIN2 7 | BUBBA2 8 | -------------------------------------------------------------------------------- /problem_set/DP/Digit.txt: -------------------------------------------------------------------------------- 1 | QHĐ chữ số 2 | BINARY 3 | SNAD 4 | DEMSO 5 | QVSICK 6 | SELFDIV 7 | NK05ORDR 8 | -------------------------------------------------------------------------------- /problem_set/Graph/DFS_BFS_set2.txt: -------------------------------------------------------------------------------- 1 | DFS - BFS set 2 2 | MESSAGE 3 | ADS 4 | THTRACE 5 | NUMBER 6 | NKPOLICE -------------------------------------------------------------------------------- /problem_set/Graph/LCA.txt: -------------------------------------------------------------------------------- 1 | LCA 2 | ONBRIDGE 3 | LUBENICA 4 | PWALK 5 | KBUILD 6 | FSELECT 7 | VMQTREE 8 | -------------------------------------------------------------------------------- /problem_set/Graph/Shortest_path_set2.txt: -------------------------------------------------------------------------------- 1 | Đường đi ngắn nhất set 2 2 | NETACCEL 3 | TTRIP 4 | QTMOVE 5 | HIWAY -------------------------------------------------------------------------------- /problem_set/VO/2012.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2012 2 | NINJUMP 3 | LKNIGHT 4 | KCOIN 5 | VOLIS 6 | MARS 7 | VOEXC 8 | -------------------------------------------------------------------------------- /problem_set/new.txt: -------------------------------------------------------------------------------- 1 | Các bài mới crawl 2 | EXPAR 3 | LUCKY13 4 | NKGAME 5 | PKADKP 6 | PKGROUP 7 | TGPASCAL -------------------------------------------------------------------------------- /problem_set/Other/Compress.txt: -------------------------------------------------------------------------------- 1 | Rời rạc hóa 2 | SPSEQ 3 | NKMOU 4 | V8MAYORS 5 | BARICAVN 6 | FOCUS 7 | C11SEQ 8 | -------------------------------------------------------------------------------- /problem_set/VO/2015.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2015 2 | VOMARBLE 3 | VOEASY 4 | VOTREE 5 | VORAIN 6 | VOPIG 7 | VOBIGNUM 8 | -------------------------------------------------------------------------------- /problem_set/VO/2016.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2016 2 | VOMOVREC 3 | VOXOR 4 | VOROOM 5 | VOGAME 6 | VOLAND 7 | VOMARIO 8 | -------------------------------------------------------------------------------- /problem_set/VOI/2012.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2012 2 | HAM12 3 | TRAVEL12 4 | MOVE12 5 | FIBVAL 6 | ROBOCON 7 | CROSS12 -------------------------------------------------------------------------------- /problem_set/VOI/2013.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2013 2 | BONUS13 3 | MESSAGE1 4 | COMNET 5 | STMERGE 6 | TOURS13 7 | ORGAN -------------------------------------------------------------------------------- /problem_set/VOI/2014.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2014 2 | MINROAD 3 | LCS2X 4 | AZNET 5 | BALLGMVN 6 | QOS 7 | JOBSET 8 | -------------------------------------------------------------------------------- /problem_set/Other/2_pointers.txt: -------------------------------------------------------------------------------- 1 | 2 con trỏ 2 | SOPENP 3 | KRECT 4 | QBTICKET 5 | HELPPM 6 | PRODUCT 7 | MATRIX 8 | -------------------------------------------------------------------------------- /problem_set/VO/2013.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2013 2 | VOCARD 3 | VOCACTUS 4 | VOBOARD 5 | VOSTR 6 | VOLIGHTS 7 | VODEFEND 8 | -------------------------------------------------------------------------------- /problem_set/VO/2017.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2017 2 | VO17BACH 3 | VO17LAN 4 | VO17PHD 5 | VO17SORT 6 | VO17TV 7 | VO17XXX 8 | -------------------------------------------------------------------------------- /problem_set/VOI/2011.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2011 2 | BONUS 3 | COLOREC 4 | TREELINE 5 | BWPOINTS 6 | PARIGAME 7 | UPGRANET -------------------------------------------------------------------------------- /problem_set/VOI/2016.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2016 2 | SEQ198 3 | VOHAUCAN 4 | IDCODE 5 | RBULL 6 | VOIEXAM 7 | VODONCAY 8 | -------------------------------------------------------------------------------- /problem_set/DP/Optimization.txt: -------------------------------------------------------------------------------- 1 | QHĐ với optimization - QHĐ bao lồi 2 | OPTCUT 3 | DTGAME 4 | BAABO 5 | HARBINGE 6 | NKLEAVES -------------------------------------------------------------------------------- /problem_set/Other/matrix_multiplication.txt: -------------------------------------------------------------------------------- 1 | Nhân ma trận 2 | CONNECTE 3 | LATGACH4 4 | INKPRINT 5 | C11DK2 6 | VMYT 7 | -------------------------------------------------------------------------------- /problem_set/VO/2014.txt: -------------------------------------------------------------------------------- 1 | VNOI Online 2014 2 | VOBOARD2 3 | VOPLANE 4 | VOTELPH 5 | VOGCDSUM 6 | VOBOARD3 7 | VOBRACK 8 | -------------------------------------------------------------------------------- /problem_set/VOI/2015.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2015 2 | TFIELD 3 | CRYPTKEY 4 | REFORM 5 | MINCUT 6 | VODIVIDE 7 | VOITSORT 8 | -------------------------------------------------------------------------------- /statement_resources/CAR.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/CAR.rar -------------------------------------------------------------------------------- /statement_resources/ENET.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/ENET.rar -------------------------------------------------------------------------------- /statement_resources/GOLD.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/GOLD.rar -------------------------------------------------------------------------------- /statement_resources/XOR.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/XOR.rar -------------------------------------------------------------------------------- /statement_resources/liq.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/liq.zip -------------------------------------------------------------------------------- /problem_set/VOI/2006.txt: -------------------------------------------------------------------------------- 1 | Đề HSG QG năm 2006 2 | QBSELECT 3 | QBBISHOP 4 | QBCIRARC 5 | QBCHANGE 6 | NKONEARC 7 | NKPATH 8 | NKMAXSEQ -------------------------------------------------------------------------------- /statement_resources/Circuit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/Circuit.pdf -------------------------------------------------------------------------------- /statement_resources/VMCOUNT.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/VMCOUNT.zip -------------------------------------------------------------------------------- /statement_resources/VMVSOS.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/VMVSOS.zip -------------------------------------------------------------------------------- /statement_resources/cheat.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/cheat.zip -------------------------------------------------------------------------------- /statement_resources/floyd.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/floyd.rar -------------------------------------------------------------------------------- /statement_resources/ptree.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/ptree.rar -------------------------------------------------------------------------------- /statement_resources/MILITARY.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/MILITARY.rar -------------------------------------------------------------------------------- /statement_resources/Triagles.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/Triagles.pdf -------------------------------------------------------------------------------- /statement_resources/Triminos.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/Triminos.pdf -------------------------------------------------------------------------------- /statement_resources/DH-2020-10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/DH-2020-10.pdf -------------------------------------------------------------------------------- /statement_resources/DH-2020-11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/DH-2020-11.pdf -------------------------------------------------------------------------------- /statement_resources/PreVNOI2013A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/PreVNOI2013A.pdf -------------------------------------------------------------------------------- /statement_resources/PreVNOI2013B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/PreVNOI2013B.pdf -------------------------------------------------------------------------------- /problem_set/DP/Bitmask.txt: -------------------------------------------------------------------------------- 1 | QHĐ bit mask 2 | COWGIRL 3 | PIZZALOC 4 | VKNIGHTS 5 | LEM3 6 | QBGAME 7 | MIXUP2 8 | TRAINING 9 | MAUGIAO 10 | -------------------------------------------------------------------------------- /problem_set/String/KMP_Z_Hash.txt: -------------------------------------------------------------------------------- 1 | KMP - Z-function - Hash 2 | PALINX 3 | DTKSUB 4 | DTCSTR 5 | TWOOPERS 6 | V11STR 7 | VOSTR 8 | SUBSTR 9 | PALINY -------------------------------------------------------------------------------- /problem_set/Other/DnC.txt: -------------------------------------------------------------------------------- 1 | Divide n Conquer (Chia để trị) 2 | COIN34 3 | POWER 4 | VECTOR 5 | MBIPALIN 6 | LQDDIV 7 | DTTUI1 8 | DGOLD 9 | MMOD29 10 | -------------------------------------------------------------------------------- /statement_resources/VMSHAPE_sample_test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leduythuccs/VOJ-rebuild-discord-bot/HEAD/statement_resources/VMSHAPE_sample_test.zip -------------------------------------------------------------------------------- /problem_set/DP/Tree.txt: -------------------------------------------------------------------------------- 1 | QHĐ trên cây 2 | PTREE 3 | CTREE 4 | TREECST 5 | MTREE 6 | MROADS 7 | LQDXEUI 8 | V8ORG 9 | KINGDOM 10 | STONE1 11 | ITREE 12 | -------------------------------------------------------------------------------- /problem_set/DP/Lexicographical.txt: -------------------------------------------------------------------------------- 1 | QHĐ thứ tự từ điển 2 | CHUOIHAT 3 | SHHV 4 | SHTH 5 | MMINPER 6 | TAPN 7 | NKLEXIC 8 | KPASS 9 | CATALAN 10 | BRACKET 11 | -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set28.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 28 2 | VPHSTAR 3 | VRATF 4 | VTRI 5 | VTRI2 6 | VWORDPOW 7 | WAVE 8 | WCALC 9 | WINCHK 10 | ZABAVA -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set04.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 04 2 | CVXPOLY 3 | DBMS 4 | DP 5 | DPER 6 | DRLINES 7 | DUAXE 8 | EGG2 9 | EQ 10 | F1 11 | F2 -------------------------------------------------------------------------------- /problem_set/Graph/Matching.txt: -------------------------------------------------------------------------------- 1 | Cặp ghép 2 | BOXES 3 | MATCH1 4 | MATCH2 5 | QBFLOWER 6 | DIVREL 7 | COMPANY3 8 | SFLOWERF 9 | NKBM 10 | NHP 11 | ASSIGN4 12 | FMATCH -------------------------------------------------------------------------------- /problem_set/Math/Number_theory.txt: -------------------------------------------------------------------------------- 1 | Số học 2 | DEGREE 3 | JACOBI 4 | NEWJ 5 | DPEQN 6 | SQUARES 7 | CPRIME 8 | PAGAIN 9 | ETF 10 | TWOREG 11 | INTEGER7 12 | C11PNUM -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set12.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 12 2 | KNCB 3 | KSEQ1 4 | KVIP 5 | LAMP 6 | LEM1 7 | LEM2 8 | LEM7 9 | LGAME 10 | LQDRACE 11 | LSORTVN -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set14.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 14 2 | MEO 3 | MEXICO 4 | MKOKOS 5 | MNE07 6 | MPRIME 7 | MTHCN 8 | MYSTERY 9 | NBFA 10 | NBFD 11 | NBFM -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set17.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 17 2 | VN_ZR_I 3 | VN_ZR_II 4 | VOSLUCKY 5 | WALK 6 | WELL2 7 | WINSTRAT 8 | WORD01 9 | WORDCNT 10 | XOR -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set11.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 11 2 | HIREHP 3 | HOUSES 4 | INFORMAC 5 | INSUL 6 | JEWELNB 7 | JUPI 8 | KAMION 9 | KAMP 10 | KENRE 11 | KKDD -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set17.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 17 2 | NKNUMFRE 3 | NKPOS 4 | NKRTEST 5 | NKSET 6 | NKSTEP 7 | NKTEST 8 | NORMA 9 | NRS 10 | NSRAIL 11 | NUCLEAR -------------------------------------------------------------------------------- /problem_set/Other/Brute_force.txt: -------------------------------------------------------------------------------- 1 | Duyệt 2 | CLOCK 3 | PCIRCLE 4 | ALADDIN 5 | MMATRIX 6 | DOMINO88 7 | NKMINES 8 | QBCOND 9 | FINDNUM 10 | VMMTFIVE 11 | QBHV 12 | COND 13 | -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set01.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 01 2 | AE5A1 3 | ANARC09I 4 | AP 5 | ATOURISM 6 | BGAME 7 | BNMT 8 | BOBALLS 9 | BOUNCE 10 | BRTREE 11 | BUS_ -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set03.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 03 2 | COINSET 3 | COLORECT 4 | COLOROOK 5 | COMMAND 6 | COPYDNA 7 | CORRAL 8 | CT 9 | CUTSEG 10 | CVJETICI -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set14.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 14 2 | RACE 3 | REC04 4 | RELJEF 5 | ROPER 6 | RTF 7 | SKFIB 8 | SKWLTH 9 | SKWTHR 10 | SNSEQ 11 | SPACESET -------------------------------------------------------------------------------- /problem_set/Math/combination_probability.txt: -------------------------------------------------------------------------------- 1 | Tổ hợp - Xác suất 2 | GPT 3 | SUPERSUM 4 | LOTT 5 | TWOSIDE 6 | CFLAG2 7 | BINARY2 8 | CWAY 9 | DIGIT0 10 | NSC 11 | NKPATROL 12 | -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set01.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 01 2 | ACMNB 3 | ADBRACK 4 | ALLOW 5 | AMSSEQ 6 | ANT 7 | ASSASSIN 8 | AUCTION 9 | AVLBIT 10 | BCHESS 11 | BEADSNB -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set02.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 02 2 | BGBOARD 3 | BGMAGIC 4 | BGMINE 5 | BGSTRING 6 | BGTRAVEL 7 | BILL 8 | BINPACK 9 | BINTREE 10 | BOB 11 | BOXMAN -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set03.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 03 2 | C11ANT 3 | C11ANT2 4 | C11BC2 5 | C11BC3 6 | C11BCH 7 | C11BEAU 8 | C11CAL 9 | C11CIR 10 | C11CUT 11 | C11DOLL -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set10.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 10 2 | FBRICK 3 | FERRIES 4 | FLOOD 5 | GARDEN25 6 | GOHOME 7 | GRAPE 8 | GRAPH 9 | GRAYCODE 10 | HBT1D 11 | HBTLAST -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set13.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 13 2 | LSPALIN 3 | LSPITO 4 | LSTAR 5 | LTEAM 6 | MAFIJA 7 | MAKHOA 8 | MAXARR1 9 | MAXARR2 10 | MAXARR3 11 | MECUNG -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set15.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 15 2 | NCOB 3 | NETWRKNB 4 | NHREMIND 5 | NKABD 6 | NKBUILD 7 | NKBUS 8 | NKBUSD 9 | NKCNT1 10 | NKCNT2 11 | NKCOMP -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set16.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 16 2 | NKDIST 3 | NKDIVSEQ 4 | NKEDIT 5 | NKGSHOW 6 | NKLEAGUE 7 | NKLETTER 8 | NKLP 9 | NKLUCK 10 | NKMAGE 11 | NKNL -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set20.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 20 2 | QUEENNB 3 | RABGAME1 4 | RAYGUN 5 | REGIONS 6 | REKMP 7 | RESTR 8 | RIDERHP 9 | RIVERS 10 | ROBOT2 11 | ROCKS -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set22.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 22 2 | STOCK 3 | SUBD 4 | SUMAA 5 | SWAPB 6 | TCOCOLOR 7 | TCOSEG 8 | THSL 9 | TPCDLCS 10 | TPCHOLE1 11 | TPCHOLE2 -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set23.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 23 2 | TPCLKNUM 3 | TRAKA 4 | TREASRE 5 | TREAT 6 | TRILAND 7 | TRIPHP 8 | TWOSUM 9 | V11COMET 10 | V11HH 11 | V11PLAN -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set24.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 24 2 | V11TOUR 3 | V11WATER 4 | VBF1 5 | VBF2 6 | VBGRASS 7 | VCOWCAR 8 | VCOWFLIX 9 | VMBW 10 | VMPIN 11 | VNABOR -------------------------------------------------------------------------------- /problem_set/OI/OI_set26.txt: -------------------------------------------------------------------------------- 1 | OI set 26 2 | VTRI2 3 | VWORDPOW 4 | VWORDS 5 | WAVE 6 | WCALC 7 | WEATHER 8 | WIFI 9 | WINCHK 10 | WINNER 11 | XUCXAC 12 | XYZ 13 | ZABAVA 14 | ZOOTOUR -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set02.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 02 2 | BWTRI 3 | C11DK1 4 | C11GAME1 5 | C11NUM 6 | C11STR 7 | C11TCT 8 | CAVLI 9 | CHEAP 10 | CIJEVI 11 | CLOCK01 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set05.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 05 2 | FAREY3 3 | FINFRAC 4 | FUKU11G 5 | FUKU11J 6 | FWFUNC 7 | FZ10B 8 | GCDSUM 9 | GLOVE 10 | GRNUM 11 | GSP1 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set06.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 06 2 | HCN 3 | HCN2 4 | HOUSE 5 | HSPC14A 6 | HSPC14B 7 | HSPC14C 8 | HSPC14D 9 | HSPC14E 10 | HSPC14F 11 | HSPC14G -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set11.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 11 2 | MZVRK 3 | NAIL 4 | NK05EOPR 5 | NKBRACKE 6 | NKCARD 7 | NKNL2 8 | NKTABLE 9 | NUMVN 10 | OTOCI 11 | PALDR -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set13.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 13 2 | QBSORT 3 | QBSTAR 4 | QBSTOCK 5 | QBSTR 6 | QBWIRE 7 | QMATCH 8 | QTANCOL 9 | QTKNAP 10 | QTREEV 11 | QULNUM -------------------------------------------------------------------------------- /problem_set/Geometry/Geometry_set2.txt: -------------------------------------------------------------------------------- 1 | Hình học set 2 2 | GPMB 3 | HINHTHOI 4 | FENCE 5 | AREATRI 6 | KINGDOMS 7 | KMIX 8 | VM3SETS 9 | C11TRCNT 10 | VODEFEND 11 | RECT1 12 | CARPET -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set04.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 04 2 | C11GAME2 3 | C11GAR 4 | C11GENIE 5 | C11ID 6 | C11LOCK 7 | C11NHL 8 | C11PASS 9 | C11PF 10 | C11PINES 11 | C11PIPI -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set06.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 06 2 | C11SWAP 3 | C11TEST 4 | C11TOUCH 5 | C11XOA 6 | C11XU 7 | C11YARD 8 | CBUYING 9 | CHATCHIT 10 | CINEMA 11 | CNMARBLE -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set07.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 07 2 | CRITICAL 3 | CROSS12 4 | CSTARS 5 | CTF 6 | CTNEWS 7 | CUTBOARD 8 | CUTRECT 9 | DANCING 10 | DHCIRCUI 11 | DHEXP -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set08.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 08 2 | DHFRBUS 3 | DHFUNC 4 | DHGARDEN 5 | DHLEXP 6 | DHLOCK 7 | DHLOCO 8 | DHRECT 9 | DHSERV 10 | DHTABLE 11 | DHTABLE2 -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set09.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 09 2 | DHTRI 3 | DHTRIMI 4 | DIFFSTR 5 | DIGITS88 6 | DIVSEQQ 7 | DSUMMITS 8 | DTOGRADA 9 | DTPYRA 10 | DUGOVI 11 | FACUP -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set18.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 18 2 | NUMBERS 3 | PASSWORD 4 | PBCJUMP 5 | PBCRECT 6 | PBIR 7 | PCHESS4 8 | PERC 9 | PERIODNB 10 | PERMUT 11 | PERNALTY -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set21.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 21 2 | ROTATION 3 | SALESMAN 4 | SBOOST 5 | SCCHEM 6 | SDRIVE 7 | SEARCH 8 | SEARCH1 9 | SOCCER 10 | SPBEACON 11 | SPSE -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set25.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 25 2 | VNBRACK 3 | VNCUT 4 | VOS2SUM 5 | VOS4DCUB 6 | VOSCAL 7 | VOSCOMPS 8 | VOSCUN 9 | VOSEXP 10 | VOSFENCE 11 | VOSGAME -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set26.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 26 2 | VOSHANDL 3 | VOSLIS 4 | VOSMAXK 5 | VOSMUL 6 | VOSNET 7 | VOSNSEQ 8 | VOSNUM 9 | VOSPLAY 10 | VOSPOW 11 | VOSRTRI -------------------------------------------------------------------------------- /problem_set/VM/2009.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2009 2 | TOPALIN 3 | TOINCSEQ 4 | TAMCAM 5 | SELFDIV 6 | NSC 7 | CLEAR 8 | MARBLE 9 | BLAND 10 | WINNER 11 | BINPAL 12 | SMAX 13 | FARMING 14 | -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set07.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 07 2 | HSPC14H 3 | HSPC14I 4 | HSPC14J 5 | HSPC14K 6 | HSPC14L 7 | ILSMATH2 8 | IOI2008 9 | IQ 10 | IZBORI 11 | JEDNAKOS -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set08.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 08 2 | KBSUDOKU 3 | KKKCT2 4 | KMEDIAN 5 | KRUS 6 | KSTEEPLE 7 | KTUAN 8 | LQDGRAPE 9 | LSCSC 10 | LSRLE 11 | MAJSTOR -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set10.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 10 2 | MOEBIUS 3 | MORSEDEC 4 | MOVIES 5 | MPOLEVAL 6 | MSAFE 7 | MSE08G 8 | MSE08H 9 | MSKYCODE 10 | MTANUM 11 | MTRGAME -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set12.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 12 2 | PBCISPIS 3 | PCONTEST 4 | PER 5 | PERIODNI 6 | PERREC 7 | PK11I 8 | POINT 9 | PYTHAEQ 10 | QBDISNEY 11 | QBINT -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set15.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 15 2 | SPFIBO 3 | SPHASH 4 | SPQUEUE 5 | STARGATE 6 | STRHFI 7 | SVADA 8 | TABLIC 9 | TANDV 10 | TELEPORT 11 | TNHFENCE -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set16.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 16 2 | TNHTEST 3 | TOTALODD 4 | TPCPALIN 5 | TPCPPLAR 6 | TREEK 7 | TREENUM 8 | TRES 9 | TREZOR 10 | TRICIR 11 | TRI_ -------------------------------------------------------------------------------- /problem_set/DS/BBST.txt: -------------------------------------------------------------------------------- 1 | Balanced BST (cây nhị phân cân bằng) 2 | CPPSET 3 | PASSET 4 | ORDERSET 5 | QMAX3VN 6 | LIS2VN 7 | TWIST 8 | UPIT 9 | SMARTDOG 10 | BUBBA1 11 | VMSINCOS 12 | SHUFFLEK -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set05.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 05 2 | C11POST 3 | C11PRIME 4 | C11ROOKS 5 | C11SEQ2 6 | C11SEQ3 7 | C11SEQ4 8 | C11SSTR 9 | C11STAR 10 | C11STR2 11 | C11SUM -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set19.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 19 2 | PETROLM 3 | PHEPNHAN 4 | PLACE 5 | POOL 6 | PVOI14_1 7 | PVOI14_2 8 | PVOI14_3 9 | PVOI14_4 10 | PVOI14_5 11 | PVOI14_6 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_notag_set09.txt: -------------------------------------------------------------------------------- 1 | Các bài tính AC không có tag set 09 2 | MAXISET 3 | MBRACKET 4 | MCARDS 5 | MCONSTR 6 | MCONVERT 7 | MDIGITS1 8 | MEDQUERY 9 | MGAME1 10 | MLASERP 11 | MMAXPER -------------------------------------------------------------------------------- /problem_set/OI/OI_notag_set27.txt: -------------------------------------------------------------------------------- 1 | Các bài OI không có tag set 27 2 | VOSSEQ 3 | VOSSEVEN 4 | VOSTOUR 5 | VOSTRAVL 6 | VOSTREE2 7 | VOSTRIBO 8 | VOSTRIP 9 | VPBINDEG 10 | VPDOMINO 11 | VPHRANK -------------------------------------------------------------------------------- /problem_set/Other/Game_theory.txt: -------------------------------------------------------------------------------- 1 | Lý thuyết trò chơi 2 | CHESS_ 3 | GWCOINS 4 | TRIOMINO 5 | BWGAME 6 | BNWNIM 7 | POTATO 8 | PK11E 9 | WINNER 10 | VNINGAME 11 | QTBIT 12 | MMMGAME 13 | NK05MNIM 14 | -------------------------------------------------------------------------------- /problem_set/VM/2011.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2011 2 | VMDEGREE 3 | VMLINES 4 | WELL 5 | STRATEGY 6 | MAKHOA2 7 | MAKHOA3 8 | SMARTDOG 9 | VMMTFIVE 10 | VM3PHIA 11 | VMDOMINO 12 | KNMANO 13 | SMURFS 14 | -------------------------------------------------------------------------------- /problem_set/Tutorial_set_02.txt: -------------------------------------------------------------------------------- 1 | Turorial set 2 2 | NDCCARD 3 | PBCDIV 4 | PBCGANGS 5 | PKADKP 6 | PNUMBER 7 | POST 8 | PTQMSEQ 9 | QBHEAP 10 | QBHV 11 | QBMAX 12 | QBMST 13 | QBSEQ 14 | RIDDLE 15 | VMSORT -------------------------------------------------------------------------------- /problem_set/Graph/MST_DSU.txt: -------------------------------------------------------------------------------- 1 | Cây khung nhỏ nhất - Disjoint set 2 | YUGI 3 | PBCWATER 4 | NKRACING 5 | FWATER 6 | CHEER 7 | NKCITY 8 | VNEMPIRE 9 | C11WATER 10 | QHROAD 11 | ILSBIN 12 | IOIBIN 13 | QBMST 14 | -------------------------------------------------------------------------------- /problem_set/Challenge.txt: -------------------------------------------------------------------------------- 1 | Challenge 2 | TORCH 3 | FARMING 4 | BPAINT 5 | VM10HNTW 6 | CMOUSE 7 | STRATEGY 8 | MAKHOA2 9 | VMFLOW 10 | VMPHQUA 11 | VMSUDOKU 12 | VMCROSS 13 | VMCUT 14 | VMSHAPE 15 | VMGROUP2 16 | -------------------------------------------------------------------------------- /problem_set/DP/DP_set4.txt: -------------------------------------------------------------------------------- 1 | QHĐ động chung chung set 4 2 | VOLIS 3 | QTSEQ 4 | C11FBR 5 | RABGAME 6 | VMEMPIRE 7 | QBMAX 8 | MCONVOI 9 | MPILOT 10 | ELEVATOR 11 | COND 12 | HUGEKNAP 13 | NKPATH 14 | PTRANG 15 | PBCDEM -------------------------------------------------------------------------------- /problem_set/DS/Deque_stack.txt: -------------------------------------------------------------------------------- 1 | Deque - Stack 2 | MINK 3 | KAGAIN 4 | CRECT 5 | QBSQUARE 6 | QBRECT 7 | CUTSEQS 8 | ALAKE 9 | CREC01 10 | NKGOLF 11 | MPYRAMID 12 | BLAND 13 | LANDK 14 | KPLANK 15 | C11PAIRS 16 | LSEA 17 | -------------------------------------------------------------------------------- /problem_set/VM/2010.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2010 2 | WEATHER 3 | NKBAS 4 | BPAINT 5 | ZOOTOUR 6 | SUMTREE 7 | VM10HNTW 8 | TCHESS 9 | PRODUCT 10 | CMOUSE 11 | OLDMAPS 12 | COMPUTER 13 | NETACCEL 14 | INKPRINT 15 | KINGDOMS 16 | KIDSMATH 17 | CFLAG 18 | -------------------------------------------------------------------------------- /problem_set/VM/2015.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2015 2 | VMDAOBIT 3 | VMSALARY 4 | VMCUT 5 | VMPIZZA 6 | VM15SWAP 7 | VMSUM2 8 | VMSHAPE 9 | VMRESTO 10 | VMSQUARE 11 | VMTOWN 12 | VMELLIP 13 | VMGROUP2 14 | VMCIRCLE 15 | VMPACKAGE 16 | VMCUT2 17 | VMROPES 18 | -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set18.txt: -------------------------------------------------------------------------------- 1 | ACM set 18 2 | TWO 3 | TWOBLACK 4 | TWOREG 5 | TWOSAT 6 | TWOSIDE 7 | VECTOR 8 | VN_ZR_I 9 | VN_ZR_II 10 | VOSLUCKY 11 | VUKVN 12 | WALK 13 | WELL2 14 | WINSTRAT 15 | WORD01 16 | WORDCNT 17 | WS 18 | XOINC 19 | XOR 20 | YUGI 21 | BIC -------------------------------------------------------------------------------- /problem_set/Other/Bignum.txt: -------------------------------------------------------------------------------- 1 | Xử lý số lớn 2 | CP 3 | LATGACH2 4 | SETNJA 5 | LUCKYNUM 6 | MUL2COM 7 | OWN2 8 | SPSUM 9 | NKTOSS 10 | LEM6 11 | NDIGIT 12 | CWAY 13 | CRUELL 14 | TREEPATH 15 | HEADTAIL 16 | TCONCERT 17 | DIGIT 18 | RABGAME 19 | BIGNUM 20 | VOBIGNUM 21 | PBCDEM -------------------------------------------------------------------------------- /problem_set/Ad_hoc.txt: -------------------------------------------------------------------------------- 1 | Ad hoc (không thuộc thể loại nào) 2 | PYRAMID2 3 | MIDAS 4 | CASTLE 5 | TWO 6 | ALADDIN 7 | NSP 8 | MCLONUM 9 | MTREECOL 10 | MBEEWALK 11 | MJOURNEY 12 | LQDRECT 13 | BIRD 14 | CHEAT 15 | NK2MFS 16 | NKTARDY 17 | NOTE 18 | NKTREE 19 | MULONE 20 | TCDFZ 21 | MACHINE 22 | -------------------------------------------------------------------------------- /problem_set/Other/Binary_ternary_search.txt: -------------------------------------------------------------------------------- 1 | Tìm kiếm nhị phân - tam phân 2 | MTWALK 3 | QBTRANS 4 | POWER 5 | MSTICK 6 | DTKSUB 7 | MKUHAR 8 | VUKVN 9 | MRECT1 10 | LQDNUMS 11 | NKSPILJA 12 | TOY 13 | AIRCTRL 14 | CRUELL2 15 | KTOUR 16 | C11SEQ 17 | VOEXC 18 | C11CAVE 19 | ASSIGN1 20 | PALINY -------------------------------------------------------------------------------- /problem_set/VM/2014.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2014 2 | VQUERY 3 | VMGCDSUM 4 | VMCANDLE 5 | VMHCN 6 | VMQUABEO 7 | VMCOFFEE 8 | VMSPEED 9 | VMLSEQ 10 | VMATRIX 11 | VMPRINCE 12 | VMREL6 13 | VMGOLD 14 | VMMARBLE 15 | VMWTREE 16 | VMAZE 17 | VMPHQUA 18 | VMHEARTS 19 | VMST 20 | VMSUDOKU 21 | VMCROSS -------------------------------------------------------------------------------- /problem_set/VM/2013.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2013 2 | VMEMPIRE 3 | VMCOUNT 4 | VMRR 5 | VMAOCE 6 | VMCOMP 7 | VMECLIP 8 | VMYT 9 | VMSINCOS 10 | VMFLOW 11 | VMFOUR 12 | VMKEY 13 | VMSEQ 14 | VMROOK 15 | VMMIRROR 16 | VMSCALE 17 | VMCOINS 18 | VMDOM2 19 | VMTRIP 20 | VMCXG 21 | VMCODE 22 | VMSUBSTR 23 | VMBW -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set05.txt: -------------------------------------------------------------------------------- 1 | ACM set 05 2 | ENET 3 | EQ 4 | EQSTR 5 | ETF 6 | EXPAR 7 | F1 8 | F2 9 | FAREY3 10 | FFLOW 11 | FINFRAC 12 | FIRE 13 | FLOW1 14 | FLOYD 15 | FMATCH 16 | FP 17 | FUKU11G 18 | FUKU11J 19 | FWFUNC 20 | FZ10B 21 | GCDSUM 22 | GLOVE 23 | GOLD 24 | GONDOR 25 | GPT 26 | GRNUM 27 | GS -------------------------------------------------------------------------------- /problem_set/OI/OI_set08.txt: -------------------------------------------------------------------------------- 1 | OI set 8 2 | KAMION 3 | KAMP 4 | KANDP 5 | KBUILD 6 | KCOIN 7 | KCOLLECT 8 | KDEL 9 | KDIFF 10 | KENRE 11 | KHISTORY 12 | KIDSMATH 13 | KINGDOM 14 | KINGDOMS 15 | KKDD 16 | KMIN 17 | KMIX 18 | KNCB 19 | KNMANO 20 | KPASS 21 | KPLANK 22 | KSEQ1 23 | KTOUR 24 | KTREEC 25 | KVIP 26 | LAMP 27 | LANDK -------------------------------------------------------------------------------- /problem_set/OI/OI_set09.txt: -------------------------------------------------------------------------------- 1 | OI set 9 2 | LCS2X 3 | LEM 4 | LEM1 5 | LEM2 6 | LEM3 7 | LEM4 8 | LEM5 9 | LEM6 10 | LEM7 11 | LGAME 12 | LINEGAME 13 | LITES 14 | LKNIGHT 15 | LNACS 16 | LQDBUS 17 | LQDFARM 18 | LQDRACE 19 | LSEA 20 | LSFIGHT 21 | LSORTVN 22 | LSPALIN 23 | LSPITO 24 | LSTAR 25 | LTEAM 26 | LUBENICA 27 | MAFIJA -------------------------------------------------------------------------------- /problem_set/DS/IT_BIT_set2.txt: -------------------------------------------------------------------------------- 1 | Segment Tree - Binary Indexed Tree set 2 2 | NKMOBILE 3 | NKMOU 4 | NKPAIRS 5 | NKINV 6 | LQDBUS 7 | CONANSP 8 | LEM4 9 | VPARTSUM 10 | VBLOCKS 11 | LITES 12 | SAILS 13 | SHUTTLE 14 | DRASHOOT 15 | MARBLE 16 | FIRS 17 | FOCUS 18 | MBUS 19 | KDIFF 20 | C11SEVEN 21 | C11COMP 22 | MCHAOS 23 | AREA -------------------------------------------------------------------------------- /problem_set/Graph/Flow.txt: -------------------------------------------------------------------------------- 1 | Luồng cực đại 2 | LIGHT 3 | BAOVE 4 | ENET 5 | FLOW1 6 | COST 7 | BONGDA 8 | MTOTALF 9 | MCQUERY 10 | MPART 11 | MPIGS 12 | TWOBLACK 13 | NKFLOW 14 | NKTRAFIC 15 | NKDEC 16 | NKNET 17 | WIFI 18 | TAMCAM 19 | HIWAY2 20 | FFLOW 21 | ASSIGN4 22 | HIWAY 23 | KWAY 24 | MINCOST 25 | ASSIGN1 26 | ALERT 27 | -------------------------------------------------------------------------------- /problem_set/VM/2012.txt: -------------------------------------------------------------------------------- 1 | VNOI Marathon 2012 2 | EUROCARD 3 | VMLP 4 | VMTEST 5 | BUBBA1 6 | EUROBET 7 | VMQPOFI 8 | BUBBA2 9 | VM12CIR 10 | VMMUMMY 11 | VMINTERN 12 | VMRELATE 13 | VMSCRMBL 14 | VMXGAME 15 | VM3SETS 16 | VMQTREE 17 | VMSORT 18 | VMDOTA 19 | VMSWAP 20 | VMVSOS 21 | VMTILE 22 | VMTREE 23 | VMGROUP 24 | VMGAME 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | botlogs/ 3 | __pycache__/ 4 | non_test_problem_set/ 5 | database/user_database.json 6 | database/problem_gave_database.json 7 | database/reviewed_database.json 8 | database/problem_gave_database.json 9 | database/user_database.json 10 | database/problem_gave_database.json 11 | database/user_database.json 12 | -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set01.txt: -------------------------------------------------------------------------------- 1 | ACM set 01 2 | ADS 3 | AE5A1 4 | ALADDIN 5 | ALAKE 6 | ALERT 7 | ANARC09I 8 | AP 9 | AREA 10 | ASSIGN1 11 | ASSIGN4 12 | ATOURISM 13 | BAABO 14 | BAOVE 15 | BGAME 16 | BIGNUM 17 | BINARY 18 | BINARY2 19 | BIRD 20 | BNMT 21 | BNWNIM 22 | BOBALLS 23 | BONGDA 24 | BOSS 25 | BOUNCE 26 | BOXES 27 | BRACKET -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set03.txt: -------------------------------------------------------------------------------- 1 | ACM set 03 2 | COIN34 3 | COINSET 4 | COLORECT 5 | COLOROOK 6 | COMMAND 7 | COMPANY3 8 | CON 9 | COND 10 | CONNECTE 11 | COPYDNA 12 | CORRAL 13 | COST 14 | COUNTPL 15 | COWGIRL 16 | CP 17 | CPPSET 18 | CPRIME 19 | CRATE 20 | CREC01 21 | CRECT 22 | CT 23 | CTNCLN 24 | CTNOWN 25 | CTREE 26 | CUTSEG 27 | CUTSEQS -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set04.txt: -------------------------------------------------------------------------------- 1 | ACM set 04 2 | CVJETICI 3 | CVXPOLY 4 | DBMS 5 | DBRACKET 6 | DEGREE 7 | DHCAT 8 | DISNEY1 9 | DISNEY2 10 | DIVREL 11 | DOMINO88 12 | DORUCAK 13 | DP 14 | DPEQN 15 | DPER 16 | DQUERY 17 | DRLINES 18 | DTCSTR 19 | DTDOI 20 | DTGAME 21 | DTKSUB 22 | DUAXE 23 | EARTHQK 24 | EGG 25 | EGG2 26 | ELECT 27 | ELEVATOR -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set15.txt: -------------------------------------------------------------------------------- 1 | ACM set 15 2 | QBSTAR 3 | QBSTOCK 4 | QBSTR 5 | QBTRANS 6 | QBWIRE 7 | QMATCH 8 | QMAX 9 | QMAX2 10 | QMAX3VN 11 | QTANCOL 12 | QTKNAP 13 | QTREEV 14 | QTREEX 15 | QULNUM 16 | RACE 17 | RAOVUON 18 | REC04 19 | RECT1 20 | RECTP 21 | RELJEF 22 | RIDDLE 23 | ROADS 24 | ROPER 25 | RTF 26 | SCOLLECT 27 | SETNJA -------------------------------------------------------------------------------- /problem_set/OI/OI_set10.txt: -------------------------------------------------------------------------------- 1 | OI set 10 2 | MAKHOA 3 | MARBLE 4 | MARS 5 | MAUGIAO 6 | MAXARR1 7 | MAXARR2 8 | MAXARR3 9 | MBUS 10 | MDIGITS2 11 | MECUNG 12 | MEO 13 | MESSAGE1 14 | MEXICO 15 | MINCUT 16 | MINROAD 17 | MIXUP2 18 | MKOKOS 19 | MNE07 20 | MOVE12 21 | MPRIME 22 | MPYRAMID 23 | MTHCN 24 | MYSTERY 25 | NBFA 26 | NBFD 27 | NBFM -------------------------------------------------------------------------------- /problem_set/OI/OI_set11.txt: -------------------------------------------------------------------------------- 1 | OI set 11 2 | NCOB 3 | NDCCARD 4 | NDIGIT 5 | NETACCEL 6 | NETWRKNB 7 | NHP 8 | NHREMIND 9 | NINJUMP 10 | NK2MFS 11 | NKA1 12 | NKABD 13 | NKBAS 14 | NKBM 15 | NKBUILD 16 | NKBUS 17 | NKBUSD 18 | NKCABLE 19 | NKCITY 20 | NKCNT1 21 | NKCNT2 22 | NKCOMP 23 | NKDEC 24 | NKDIST 25 | NKDIVSEQ 26 | NKEDIT 27 | NKFLOW -------------------------------------------------------------------------------- /problem_set/OI/OI_set17.txt: -------------------------------------------------------------------------------- 1 | OI set 17 2 | SAILS 3 | SALESMAN 4 | SBOOST 5 | SCCHEM 6 | SDRIVE 7 | SEARCH 8 | SEARCH1 9 | SEC 10 | SELFDIV 11 | SEQ198 12 | SHUTTLE 13 | SMARTDOG 14 | SMAX 15 | SMURFS 16 | SOCCER 17 | SPBEACON 18 | SPSE 19 | STABLE 20 | STEEL 21 | STMERGE 22 | STNODE 23 | STOCK 24 | STRAVEL 25 | SUBD 26 | SUMAA 27 | SUMTREE -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set02.txt: -------------------------------------------------------------------------------- 1 | ACM set 02 2 | BRTREE 3 | BUILD28 4 | BUS_ 5 | BWGAME 6 | BWTRI 7 | C11DK1 8 | C11GAME1 9 | C11HUM 10 | C11KM 11 | C11NUM 12 | C11STR 13 | C11TCT 14 | CAR 15 | CARPET 16 | CASTLE 17 | CATALAN 18 | CAVLI 19 | CFLAG2 20 | CHEAP 21 | CHEAT 22 | CHESS_ 23 | CHNTOWER 24 | CHUOIHAT 25 | CIJEVI 26 | CLOCK 27 | CLOCK01 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set07.txt: -------------------------------------------------------------------------------- 1 | ACM set 07 2 | HUGEKNAP 3 | ILSMATH 4 | ILSMATH2 5 | INCVN 6 | IOI2008 7 | IOIBIN 8 | IQ 9 | ITREE 10 | IVANA 11 | IZBORI 12 | JACOBI 13 | JEDNAKOS 14 | KAGAIN 15 | KBSUDOKU 16 | KINV 17 | KKKCT2 18 | KL11B 19 | KMEDIAN 20 | KQUERY 21 | KQUERY2 22 | KRECT 23 | KRUS 24 | KSTEEPLE 25 | KTUAN 26 | KWAY 27 | LABUDOVI -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set16.txt: -------------------------------------------------------------------------------- 1 | ACM set 16 2 | SFLOWERF 3 | SHHV 4 | SHTH 5 | SHUFFLEK 6 | SKFIB 7 | SKWLTH 8 | SKWTHR 9 | SLIKAR 10 | SNAD 11 | SNSEQ 12 | SOPENP 13 | SPACESET 14 | SPFIBO 15 | SPHASH 16 | SPQUEUE 17 | SPSEQ 18 | SPSUM 19 | SQUARES 20 | STARGATE 21 | STONE1 22 | STRHFI 23 | SUBSTR 24 | SUPERSUM 25 | SVADA 26 | TABLIC 27 | TANDV -------------------------------------------------------------------------------- /problem_set/OI/OI_set02.txt: -------------------------------------------------------------------------------- 1 | OI set 2 2 | BINTREE 3 | BLAND 4 | BOB 5 | BONES 6 | BONUS 7 | BONUS13 8 | BOXMAN 9 | BUBBA1 10 | BUBBA2 11 | BWPOINTS 12 | C11ANT 13 | C11ANT2 14 | C11BC1 15 | C11BC2 16 | C11BC3 17 | C11BCH 18 | C11BEAU 19 | C11CAL 20 | C11CAVE 21 | C11CIR 22 | C11COMP 23 | C11CUT 24 | C11DK2 25 | C11DOLL 26 | C11FBR 27 | C11GAME2 -------------------------------------------------------------------------------- /problem_set/OI/OI_set16.txt: -------------------------------------------------------------------------------- 1 | OI set 16 2 | QOS 3 | QTBIT 4 | QTMOVE 5 | QTREE3 6 | QTSEQ 7 | QUAD 8 | QUEENNB 9 | QVESCAPE 10 | QVSICK 11 | RABGAME 12 | RABGAME1 13 | RAYGUN 14 | RBULL 15 | RECT3 16 | REFORM 17 | REGIONS 18 | REKMP 19 | RESTR 20 | REVAMP 21 | RIDERHP 22 | RIVERS 23 | ROBOCON 24 | ROBOT2 25 | ROCKS 26 | ROTATION 27 | SAFENET2 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set12.txt: -------------------------------------------------------------------------------- 1 | ACM set 12 2 | MULONE 3 | MVECTOR 4 | MZVRK 5 | NAIL 6 | NEWJ 7 | NHPAINT 8 | NICEQUAD 9 | NK05DSRT 10 | NK05EOPR 11 | NK05MNIM 12 | NK05ORDR 13 | NKBRACKE 14 | NKCARD 15 | NKGAME 16 | NKNL2 17 | NKTABLE 18 | NKTRIO 19 | NPR 20 | NSP 21 | NUMBER 22 | NUMVN 23 | ONBRIDGE 24 | OPTCUT 25 | ORDERSET 26 | OTOCI 27 | OWN2 -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set13.txt: -------------------------------------------------------------------------------- 1 | ACM set 13 2 | PAGAIN 3 | PALDR 4 | PALINX 5 | PALINY 6 | PASSET 7 | PBCDIV 8 | PBCGANGS 9 | PBCISPIS 10 | PBCWATER 11 | PCIRCLE 12 | PCONTEST 13 | PER 14 | PERIODNI 15 | PERREC 16 | PIZZALOC 17 | PK11E 18 | PK11I 19 | PKADKP 20 | PLAHTE 21 | PNUMBER 22 | POINT 23 | POLY4 24 | POSLOZI 25 | POST 26 | POST2 27 | POTATO -------------------------------------------------------------------------------- /problem_set/OI/OI_set05.txt: -------------------------------------------------------------------------------- 1 | OI set 5 2 | CSTARS 3 | CTF 4 | CTNBULLS 5 | CTNEWS 6 | CUTBOARD 7 | CUTRECT 8 | CWAY 9 | DAMAGE 10 | DANCING 11 | DEMSO 12 | DGOLD 13 | DHCIRCUI 14 | DHEXP 15 | DHFRBUS 16 | DHFUNC 17 | DHGARDEN 18 | DHLEXP 19 | DHLOCK 20 | DHLOCO 21 | DHRECT 22 | DHSERV 23 | DHTABLE 24 | DHTABLE2 25 | DHTRI 26 | DHTRIMI 27 | DIAMOND -------------------------------------------------------------------------------- /problem_set/OI/OI_set06.txt: -------------------------------------------------------------------------------- 1 | OI set 6 2 | DIFFSTR 3 | DIGIT 4 | DIGIT0 5 | DIGITS88 6 | DIVSEQQ 7 | DRASHOOT 8 | DSUMMITS 9 | DTOGRADA 10 | DTPYRA 11 | DTTUI1 12 | DTTUI2 13 | DUGOVI 14 | EUROBET 15 | EUROCARD 16 | FACUP 17 | FBRICK 18 | FENCE 19 | FERRIES 20 | FIBVAL 21 | FINDNUM 22 | FIRS 23 | FLOOD 24 | FLOWER 25 | FOCUS 26 | FSELECT 27 | FWATER -------------------------------------------------------------------------------- /problem_set/OI/OI_set07.txt: -------------------------------------------------------------------------------- 1 | OI set 7 2 | GARDEN25 3 | GOHOME 4 | GPMB 5 | GRAPE 6 | GRAPH 7 | GRAPH_ 8 | GRAYCODE 9 | HAM12 10 | HAOI6000 11 | HBT1D 12 | HBTLAST 13 | HEADTAIL 14 | HELPPM 15 | HINHTHOI 16 | HIREHP 17 | HIWAY2 18 | HOUSES 19 | IDCODE 20 | ILSBIN 21 | INFORMAC 22 | INKPRINT 23 | INSUL 24 | INTEGER7 25 | JEWELNB 26 | JOBSET 27 | JUPI -------------------------------------------------------------------------------- /problem_set/OI/OI_set13.txt: -------------------------------------------------------------------------------- 1 | OI set 13 2 | NKPALIN 3 | NKPANO 4 | NKPARITY 5 | NKPATH 6 | NKPATROL 7 | NKPOLI 8 | NKPOLICE 9 | NKPOLY 10 | NKPOS 11 | NKRACING 12 | NKREZ 13 | NKRTEST 14 | NKSEQ 15 | NKSET 16 | NKSEV 17 | NKSGAME 18 | NKSP 19 | NKSPILJA 20 | NKSTEP 21 | NKTARDY 22 | NKTEAM 23 | NKTEST 24 | NKTICK 25 | NKTOSS 26 | NKTRAFIC 27 | NKTREE -------------------------------------------------------------------------------- /problem_set/OI/OI_set14.txt: -------------------------------------------------------------------------------- 1 | OI set 14 2 | NORMA 3 | NOTE 4 | NRS 5 | NSC 6 | NSRAIL 7 | NUCLEAR 8 | NUMBERS 9 | OLDMAPS 10 | ORGAN 11 | PAGODA 12 | PARIGAME 13 | PASSWORD 14 | PBCDEM 15 | PBCJUMP 16 | PBCPOINT 17 | PBCRECT 18 | PBIR 19 | PCHESS4 20 | PCYCLE 21 | PERC 22 | PERIODNB 23 | PERMUT 24 | PERNALTY 25 | PETROLM 26 | PHEPNHAN 27 | PKGROUP -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set06.txt: -------------------------------------------------------------------------------- 1 | ACM set 06 2 | GSP1 3 | GSS 4 | GWCOINS 5 | HAOI5000 6 | HARBINGE 7 | HBTLCA 8 | HCN 9 | HCN2 10 | HEADQRT 11 | HEAP1 12 | HIWAY 13 | HNSUBWAY 14 | HOUSE 15 | HOUSES2 16 | HSPC14A 17 | HSPC14B 18 | HSPC14C 19 | HSPC14D 20 | HSPC14E 21 | HSPC14F 22 | HSPC14G 23 | HSPC14H 24 | HSPC14I 25 | HSPC14J 26 | HSPC14K 27 | HSPC14L -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set14.txt: -------------------------------------------------------------------------------- 1 | ACM set 14 2 | POWER 3 | PRAVO 4 | PRETTYP 5 | PTQMSEQ 6 | PTREE 7 | PYRAMID2 8 | PYTHAEQ 9 | QBAGENTS 10 | QBBUILD 11 | QBCAKE 12 | QBDISNEY 13 | QBDIVSEQ 14 | QBFLOWER 15 | QBHEAP 16 | QBHV 17 | QBINT 18 | QBMAX 19 | QBMST 20 | QBPAL 21 | QBPIZZA 22 | QBPOINT 23 | QBRECT 24 | QBSCHOOL 25 | QBSEQ 26 | QBSORT 27 | QBSQUARE -------------------------------------------------------------------------------- /problem_set/DP/DP_set1.txt: -------------------------------------------------------------------------------- 1 | QHĐ động chung chung set 1 2 | LAZYCOWS 3 | CP 4 | KINV 5 | EGG 6 | THEME 7 | LIQ 8 | LIS 9 | HAOI5000 10 | LATGACH 11 | DISNEY1 12 | DISNEY2 13 | QBSQUARE 14 | QBPAL 15 | QBCAKE 16 | IVANA 17 | QBDIVSEQ 18 | CUTSEQS 19 | PRETTYP 20 | MAJMUN 21 | SCOLLECT 22 | MCOINS 23 | MDOLLS 24 | MSTRING 25 | LIS2VN 26 | CTNOWN 27 | OWN2 -------------------------------------------------------------------------------- /problem_set/DP/DP_set2.txt: -------------------------------------------------------------------------------- 1 | QHĐ động chung chung set 2 2 | INCVN 3 | FP 4 | MDOSTAVA 5 | MREPLBRC 6 | MFISH 7 | DTDOI 8 | LQDGONME 9 | CTNCLN 10 | XOINC 11 | SPSEQ 12 | DHCAT 13 | EQSTR 14 | CHNTOWER 15 | NKPALIN 16 | NKREZ 17 | NKA1 18 | NKMINERS 19 | NKPOLY 20 | NKTOSS 21 | NKTICK 22 | NKPANO 23 | NKCABLE 24 | LQDBUS 25 | V8SCORE 26 | LEM5 27 | CATGO -------------------------------------------------------------------------------- /problem_set/OI/OI_set01.txt: -------------------------------------------------------------------------------- 1 | OI set 1 2 | ACMNB 3 | ADBRACK 4 | AIRCTRL 5 | ALLOW 6 | AMSSEQ 7 | ANT 8 | AREATRI 9 | ASSASSIN 10 | AUCTION 11 | AVLBIT 12 | AZNET 13 | BALLGMVN 14 | BARIC 15 | BARICAVN 16 | BCHESS 17 | BEADSNB 18 | BESTSPOT 19 | BGBOARD 20 | BGMAGIC 21 | BGMINE 22 | BGSTRING 23 | BGTRAVEL 24 | BILL 25 | BINLADEN 26 | BINPACK 27 | BINPAL -------------------------------------------------------------------------------- /problem_set/OI/OI_set12.txt: -------------------------------------------------------------------------------- 1 | OI set 12 2 | NKGIFTS 3 | NKGOLF 4 | NKGSHOW 5 | NKGUARD 6 | NKH 7 | NKINV 8 | NKJUMP 9 | NKLAND 10 | NKLEAGUE 11 | NKLEAVES 12 | NKLETTER 13 | NKLEXIC 14 | NKLINEUP 15 | NKLP 16 | NKLUCK 17 | NKMAGE 18 | NKMAXSEQ 19 | NKMINERS 20 | NKMINES 21 | NKMOBILE 22 | NKMOU 23 | NKNET 24 | NKNL 25 | NKNUMFRE 26 | NKONEARC 27 | NKPAIRS -------------------------------------------------------------------------------- /problem_set/OI/OI_set18.txt: -------------------------------------------------------------------------------- 1 | OI set 18 2 | SWAPB 3 | TAMCAM 4 | TAXID 5 | TBIKE 6 | TCHESS 7 | TCOCOLOR 8 | TCONCERT 9 | TCOSEG 10 | TFIELD 11 | THSL 12 | TJALG 13 | TOINCSEQ 14 | TOPALIN 15 | TOURS13 16 | TOY 17 | TPCDLCS 18 | TPCHOLE1 19 | TPCHOLE2 20 | TPCLKNUM 21 | TRAINING 22 | TRAKA 23 | TRAVEL12 24 | TREASRE 25 | TREAT 26 | TREELINE 27 | TREEPATH -------------------------------------------------------------------------------- /problem_set/OI/OI_set19.txt: -------------------------------------------------------------------------------- 1 | OI set 19 2 | TRIBE 3 | TRILAND 4 | TRIPHP 5 | TTRIP 6 | TWOOPERS 7 | TWOSUM 8 | UPGRANET 9 | UPIT 10 | V11COMET 11 | V11HH 12 | V11PLAN 13 | V11STR 14 | V11TOUR 15 | V11WATER 16 | V8MAYORS 17 | V8ORG 18 | V8SCORE 19 | V8SORT 20 | VBF1 21 | VBF2 22 | VBGRASS 23 | VBLOCKS 24 | VBOARD 25 | VCOLDWAT 26 | VCOWCAR 27 | VCOWFLIX -------------------------------------------------------------------------------- /problem_set/OI/OI_set22.txt: -------------------------------------------------------------------------------- 1 | OI set 22 2 | VMRESTO 3 | VMROOK 4 | VMROPES 5 | VMRR 6 | VMSALARY 7 | VMSCALE 8 | VMSCRMBL 9 | VMSEQ 10 | VMSINCOS 11 | VMSORT 12 | VMSPEED 13 | VMSQUARE 14 | VMST 15 | VMSUBSTR 16 | VMSUDOKU 17 | VMSUM2 18 | VMSWAP 19 | VMTEST 20 | VMTILE 21 | VMTOWN 22 | VMTREE 23 | VMTRIP 24 | VMUNCH 25 | VMVSOS 26 | VMWTREE 27 | VMXGAME -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set08.txt: -------------------------------------------------------------------------------- 1 | ACM set 08 2 | LATGACH 3 | LATGACH2 4 | LATGACH4 5 | LAZYCOWS 6 | LIGHT 7 | LIQ 8 | LIS 9 | LIS2VN 10 | LOTT 11 | LQDALH 12 | LQDDIV 13 | LQDGONME 14 | LQDGRAPE 15 | LQDHAUNT 16 | LQDNUMS 17 | LQDQPER 18 | LQDRECT 19 | LQDXEUI 20 | LSCSC 21 | LSRLE 22 | LTPMSEQ 23 | LUCKY13 24 | LUCKYNUM 25 | M00PAIR 26 | M3TILE 27 | MACHINE -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set10.txt: -------------------------------------------------------------------------------- 1 | ACM set 10 2 | MDOSTAVA 3 | MEDIAN 4 | MEDQUERY 5 | MELE2 6 | MELE3 7 | MESSAGE 8 | METERAIN 9 | MFISH 10 | MGAME1 11 | MIDAS 12 | MILITARY 13 | MINCOST 14 | MINK 15 | MJOURNEY 16 | MKUHAR 17 | MLASERP 18 | MMASS 19 | MMATRIX 20 | MMAXPER 21 | MMINPER 22 | MMMGAME 23 | MMOD29 24 | MNERED 25 | MOEBIUS 26 | MORSEDEC 27 | MOVIES -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set11.txt: -------------------------------------------------------------------------------- 1 | ACM set 11 2 | MPART 3 | MPIGS 4 | MPILOT 5 | MPOLEVAL 6 | MPRIME1 7 | MRECAMAN 8 | MRECT1 9 | MREPLBRC 10 | MROADS 11 | MSAFE 12 | MSE06H 13 | MSE07B 14 | MSE08G 15 | MSE08H 16 | MSKYCODE 17 | MSTICK 18 | MSTRING 19 | MTANUM 20 | MTELE 21 | MTOTALF 22 | MTREE 23 | MTREECOL 24 | MTRGAME 25 | MTRIAREA 26 | MTWALK 27 | MUL2COM -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set17.txt: -------------------------------------------------------------------------------- 1 | ACM set 17 2 | TAPN 3 | TCDFZ 4 | TELEPORT 5 | TGPASCAL 6 | THEME 7 | THTRACE 8 | TNHFENCE 9 | TNHTEST 10 | TNHWIFI 11 | TOTALODD 12 | TOUR2509 13 | TPCPALIN 14 | TPCPPLAR 15 | TRAFFICN 16 | TREECST 17 | TREEK 18 | TREENUM 19 | TRES 20 | TREZOR 21 | TRI_ 22 | TRIANGLE 23 | TRICIR 24 | TRIOMINO 25 | TRIPOD 26 | TRIPOD2 27 | TWIST -------------------------------------------------------------------------------- /problem_set/DP/DP_set3.txt: -------------------------------------------------------------------------------- 1 | QHĐ động chung chung set 3 2 | VSTEPS 3 | CDMUSIC 4 | VBLOCKS 5 | NKH 6 | TRIBE 7 | LSFIGHT 8 | RECT3 9 | FLOWER 10 | BONES 11 | QUAD 12 | NKSP 13 | XYZ 14 | BARIC 15 | CTNBULLS 16 | DIAMOND 17 | POINTS2 18 | DTTUI2 19 | COMPUTER 20 | FINDNUM 21 | LQDFARM 22 | KCOLLECT 23 | KNMANO 24 | C11BC1 25 | HEADTAIL 26 | TBIKE 27 | VOVAGAME -------------------------------------------------------------------------------- /problem_set/DS/IT_BIT_set1.txt: -------------------------------------------------------------------------------- 1 | Segment Tree - Binary Indexed Tree set 1 2 | GSS 3 | QMAX 4 | QMAX2 5 | MINK 6 | KINV 7 | GOLD 8 | RECTP 9 | LIS 10 | KQUERY 11 | DQUERY 12 | KQUERY2 13 | WS 14 | BOSS 15 | ORDERSET 16 | CUTSEQS 17 | SLIKAR 18 | CRATE 19 | INCVN 20 | NHPAINT 21 | MSE06H 22 | SPSEQ 23 | KL11B 24 | LQDQPER 25 | NKREZ 26 | NKLINEUP 27 | NKTEAM -------------------------------------------------------------------------------- /problem_set/OI/OI_set04.txt: -------------------------------------------------------------------------------- 1 | OI set 4 2 | C11TRCNT 3 | C11WATER 4 | C11XOA 5 | C11XU 6 | C11YARD 7 | CATGO 8 | CBUYING 9 | CDMUSIC 10 | CENTRE28 11 | CFLAG 12 | CHAIN2 13 | CHATCHIT 14 | CHEER 15 | CINEMA 16 | CLEAR 17 | CNMARBLE 18 | COLLECT 19 | COLOREC 20 | COMNET 21 | COMPUTER 22 | CONANSP 23 | CRITICAL 24 | CROSS12 25 | CRUELL 26 | CRUELL2 27 | CRYPTKEY -------------------------------------------------------------------------------- /problem_set/OI/OI_set25.txt: -------------------------------------------------------------------------------- 1 | OI set 25 2 | VOSNSEQ 3 | VOSNUM 4 | VOSPLAY 5 | VOSPOW 6 | VOSRTRI 7 | VOSSEQ 8 | VOSSEVEN 9 | VOSTOUR 10 | VOSTR 11 | VOSTRAVL 12 | VOSTREE2 13 | VOSTRIBO 14 | VOSTRIP 15 | VOTELPH 16 | VOTREE 17 | VOVAGAME 18 | VOXOR 19 | VPARTSUM 20 | VPBINDEG 21 | VPDOMINO 22 | VPHRANK 23 | VPHSTAR 24 | VQUERY 25 | VRATF 26 | VSTEPS 27 | VTRI -------------------------------------------------------------------------------- /problem_set/ACM/ACM_set09.txt: -------------------------------------------------------------------------------- 1 | ACM set 09 2 | MAJMUN 3 | MAJSTOR 4 | MATCH1 5 | MATCH2 6 | MATRIX 7 | MAXCUB 8 | MAXISET 9 | MAXNUM 10 | MBEEWALK 11 | MBIPALIN 12 | MBLAST 13 | MBRACKET 14 | MCARDS 15 | MCHAOS 16 | MCIRGAME 17 | MCITYHAL 18 | MCLEAN 19 | MCLONUM 20 | MCOINS 21 | MCONSTR 22 | MCONVERT 23 | MCONVOI 24 | MCQUERY 25 | MDIGITS 26 | MDIGITS1 27 | MDOLLS -------------------------------------------------------------------------------- /problem_set/OI/OI_set03.txt: -------------------------------------------------------------------------------- 1 | OI set 3 2 | C11GAR 3 | C11GENIE 4 | C11ID 5 | C11LOCK 6 | C11NHL 7 | C11PAIRS 8 | C11PASS 9 | C11PF 10 | C11PINES 11 | C11PIPI 12 | C11PNUM 13 | C11POST 14 | C11PRIME 15 | C11ROOKS 16 | C11SEQ 17 | C11SEQ2 18 | C11SEQ3 19 | C11SEQ4 20 | C11SEVEN 21 | C11SSTR 22 | C11STAR 23 | C11STR2 24 | C11SUM 25 | C11SWAP 26 | C11TEST 27 | C11TOUCH -------------------------------------------------------------------------------- /problem_set/OI/OI_set20.txt: -------------------------------------------------------------------------------- 1 | OI set 20 2 | VCRISIS 3 | VDANGER 4 | VKNIGHTS 5 | VM12CIR 6 | VM15SWAP 7 | VM3PHIA 8 | VM3SETS 9 | VMAOCE 10 | VMATRIX 11 | VMAZE 12 | VMBW 13 | VMCANDLE 14 | VMCIRCLE 15 | VMCODE 16 | VMCOFFEE 17 | VMCOINS 18 | VMCOMP 19 | VMCOUNT 20 | VMCUT2 21 | VMCXG 22 | VMDAOBIT 23 | VMDEGREE 24 | VMDOM2 25 | VMDOMINO 26 | VMDOTA 27 | VMECLIP -------------------------------------------------------------------------------- /problem_set/OI/OI_set24.txt: -------------------------------------------------------------------------------- 1 | OI set 24 2 | VOHAUCAN 3 | VOIEXAM 4 | VOITSORT 5 | VOLAND 6 | VOLIGHTS 7 | VOLIS 8 | VOMARBLE 9 | VOMARIO 10 | VOMOVREC 11 | VOPIG 12 | VOPLANE 13 | VORAIN 14 | VOROOM 15 | VOS2SUM 16 | VOS4DCUB 17 | VOSCAL 18 | VOSCOMPS 19 | VOSCUN 20 | VOSEXP 21 | VOSFENCE 22 | VOSGAME 23 | VOSHANDL 24 | VOSLIS 25 | VOSMAXK 26 | VOSMUL 27 | VOSNET -------------------------------------------------------------------------------- /problem_set/Tutorial_set_01.txt: -------------------------------------------------------------------------------- 1 | Tutorial set 1 2 | BIGNUM 3 | C11HUM 4 | C11KM 5 | COUNTPL 6 | FFLOW 7 | FMATCH 8 | HBTLCA 9 | ILSMATH 10 | IOIBIN 11 | LTPMSEQ 12 | M00PAIR 13 | M3TILE 14 | MAXNUM 15 | MBLAST 16 | MCIRGAME 17 | MCITYHAL 18 | MCONVOI 19 | MDIGITS 20 | MDIGITS2 21 | MMASS 22 | MMMGAME 23 | MMOD29 24 | MNERED 25 | MPRIME1 26 | MRECAMAN 27 | MSE07B -------------------------------------------------------------------------------- /problem_set/Geometry/Geometry_set1.txt: -------------------------------------------------------------------------------- 1 | Hình học set 1 2 | METERAIN 3 | POLY4 4 | MILITARY 5 | PRAVO 6 | RAOVUON 7 | QBPOINT 8 | QBCAKE 9 | QBPIZZA 10 | FIRE 11 | TRIPOD 12 | BUILD28 13 | TRIPOD2 14 | HNSUBWAY 15 | EARTHQK 16 | HEADQRT 17 | MTRIAREA 18 | DORUCAK 19 | MVECTOR 20 | LQDALH 21 | HOUSES2 22 | NICEQUAD 23 | TNHWIFI 24 | STEEL 25 | NKPOLI 26 | NKLAND 27 | LEM -------------------------------------------------------------------------------- /problem_set/OI/OI_set15.txt: -------------------------------------------------------------------------------- 1 | OI set 15 2 | PLACE 3 | POINTS2 4 | POOL 5 | PRODUCT 6 | PTRANG 7 | PVOI14_1 8 | PVOI14_2 9 | PVOI14_3 10 | PVOI14_4 11 | PVOI14_5 12 | PVOI14_6 13 | PWALK 14 | PWRFAIL 15 | QBBISHOP 16 | QBCHANGE 17 | QBCIRARC 18 | QBCOND 19 | QBFIREWK 20 | QBGAME 21 | QBMARKET 22 | QBMSEQ 23 | QBROBOT 24 | QBSEGPAR 25 | QBSELECT 26 | QBTICKET 27 | QHROAD -------------------------------------------------------------------------------- /problem_set/OI/OI_set21.txt: -------------------------------------------------------------------------------- 1 | OI set 21 2 | VMELLIP 3 | VMEMPIRE 4 | VMFOUR 5 | VMGAME 6 | VMGCDSUM 7 | VMGOLD 8 | VMGROUP 9 | VMHCN 10 | VMHEARTS 11 | VMINTERN 12 | VMKEY 13 | VMLINES 14 | VMLSEQ 15 | VMMARBLE 16 | VMMIRROR 17 | VMMTFIVE 18 | VMMUMMY 19 | VMPACKAGE 20 | VMPIN 21 | VMPIZZA 22 | VMPRINCE 23 | VMQPOFI 24 | VMQTREE 25 | VMQUABEO 26 | VMREL6 27 | VMRELATE -------------------------------------------------------------------------------- /problem_set/OI/OI_set23.txt: -------------------------------------------------------------------------------- 1 | OI set 23 2 | VMYT 3 | VNABOR 4 | VNBRACK 5 | VNCUT 6 | VNEMPIRE 7 | VNINGAME 8 | VO17BACH 9 | VO17LAN 10 | VO17PHD 11 | VO17SORT 12 | VO17TV 13 | VO17XXX 14 | VOBIGNUM 15 | VOBOARD 16 | VOBOARD2 17 | VOBOARD3 18 | VOBRACK 19 | VOCACTUS 20 | VOCARD 21 | VODEFEND 22 | VODIVIDE 23 | VODONCAY 24 | VOEASY 25 | VOEXC 26 | VOGAME 27 | VOGCDSUM -------------------------------------------------------------------------------- /problem_set/Graph/DFS_BFS_set1.txt: -------------------------------------------------------------------------------- 1 | DFS - BFS set 1 2 | MTWALK 3 | LABUDOVI 4 | QBAGENTS 5 | NKTRIO 6 | MCLEAN 7 | MTELE 8 | VUKVN 9 | WEATHER 10 | NKONEARC 11 | NKPARITY 12 | VWORDS 13 | SAFENET2 14 | VCOLDWAT 15 | VMUNCH 16 | XUCXAC 17 | KANDP 18 | HAOI6000 19 | NKGUARD 20 | DAMAGE 21 | GRAPH_ 22 | TJALG 23 | KCOLLECT 24 | KTREEC 25 | KHISTORY 26 | VMMUMMY 27 | VOCACTUS -------------------------------------------------------------------------------- /problem_set/Graph/Shortest_path_set1.txt: -------------------------------------------------------------------------------- 1 | Đường đi ngắn nhất set 1 2 | ROADS 3 | NK05DSRT 4 | FLOYD 5 | QBSCHOOL 6 | QBBUILD 7 | QBTRANS 8 | TRAFFICN 9 | GONDOR 10 | MCLEAN 11 | MELE2 12 | MELE3 13 | POSLOZI 14 | LQDHAUNT 15 | V8SORT 16 | PBCPOINT 17 | VCRISIS 18 | VDANGER 19 | CENTRE28 20 | QVESCAPE 21 | NHP 22 | KANDP 23 | BINLADEN 24 | PWRFAIL 25 | STRAVEL 26 | BESTSPOT 27 | REVAMP -------------------------------------------------------------------------------- /.env-example: -------------------------------------------------------------------------------- 1 | DISCORD_TOKEN= 2 | DISCORD_LOG_CHANNEL_ID= 3 | POLYGON_USERNAME= 4 | POLYGON_PASSWORD= 5 | POLYGON_API_KEY= 6 | POLYGON_API_SECRET= 7 | CODEFORCES_USERNAME= 8 | CODEFORCES_PASSWORD= 9 | CODEFORCES_GROUP_ID= -------------------------------------------------------------------------------- /problem_set/Graph/DFS_BFS.txt: -------------------------------------------------------------------------------- 1 | DFS - BFS 2 | MTWALK 3 | LABUDOVI 4 | QBAGENTS 5 | NKTRIO 6 | MCLEAN 7 | MTELE 8 | VUKVN 9 | WEATHER 10 | NKONEARC 11 | NKPARITY 12 | VWORDS 13 | SAFENET2 14 | VCOLDWAT 15 | VMUNCH 16 | XUCXAC 17 | KANDP 18 | HAOI6000 19 | NKGUARD 20 | DAMAGE 21 | GRAPH_ 22 | TJALG 23 | KCOLLECT 24 | KTREEC 25 | KHISTORY 26 | VMMUMMY 27 | VOCACTUS 28 | MESSAGE 29 | ADS 30 | THTRACE 31 | NUMBER 32 | NKPOLICE -------------------------------------------------------------------------------- /problem_set/Graph/Shortest_path.txt: -------------------------------------------------------------------------------- 1 | Đường đi ngắn nhất 2 | ROADS 3 | NK05DSRT 4 | FLOYD 5 | QBSCHOOL 6 | QBBUILD 7 | QBTRANS 8 | TRAFFICN 9 | GONDOR 10 | MCLEAN 11 | MELE2 12 | MELE3 13 | POSLOZI 14 | LQDHAUNT 15 | V8SORT 16 | PBCPOINT 17 | VCRISIS 18 | VDANGER 19 | CENTRE28 20 | QVESCAPE 21 | NHP 22 | KANDP 23 | BINLADEN 24 | PWRFAIL 25 | STRAVEL 26 | BESTSPOT 27 | REVAMP 28 | NETACCEL 29 | TTRIP 30 | QTMOVE 31 | HIWAY 32 | -------------------------------------------------------------------------------- /problem_set/Geometry/Geometry.txt: -------------------------------------------------------------------------------- 1 | Hình học 2 | METERAIN 3 | POLY4 4 | MILITARY 5 | PRAVO 6 | RAOVUON 7 | QBPOINT 8 | QBCAKE 9 | QBPIZZA 10 | FIRE 11 | TRIPOD 12 | BUILD28 13 | TRIPOD2 14 | HNSUBWAY 15 | EARTHQK 16 | HEADQRT 17 | MTRIAREA 18 | DORUCAK 19 | MVECTOR 20 | LQDALH 21 | HOUSES2 22 | NICEQUAD 23 | TNHWIFI 24 | STEEL 25 | NKPOLI 26 | NKLAND 27 | LEM 28 | GPMB 29 | HINHTHOI 30 | FENCE 31 | AREATRI 32 | KINGDOMS 33 | KMIX 34 | VM3SETS 35 | C11TRCNT 36 | VODEFEND 37 | RECT1 38 | CARPET -------------------------------------------------------------------------------- /problem_set/DS/IT_BIT.txt: -------------------------------------------------------------------------------- 1 | Segment Tree - Binary Indexed Tree 2 | GSS 3 | QMAX 4 | QMAX2 5 | MINK 6 | KINV 7 | GOLD 8 | RECTP 9 | LIS 10 | KQUERY 11 | DQUERY 12 | KQUERY2 13 | WS 14 | BOSS 15 | ORDERSET 16 | CUTSEQS 17 | SLIKAR 18 | CRATE 19 | INCVN 20 | NHPAINT 21 | MSE06H 22 | SPSEQ 23 | KL11B 24 | LQDQPER 25 | NKREZ 26 | NKLINEUP 27 | NKTEAM 28 | NKMOBILE 29 | NKMOU 30 | NKPAIRS 31 | NKINV 32 | LQDBUS 33 | CONANSP 34 | LEM4 35 | VPARTSUM 36 | VBLOCKS 37 | LITES 38 | SAILS 39 | SHUTTLE 40 | DRASHOOT 41 | MARBLE 42 | FIRS 43 | FOCUS 44 | MBUS 45 | KDIFF 46 | C11SEVEN 47 | C11COMP 48 | MCHAOS 49 | AREA 50 | -------------------------------------------------------------------------------- /checker/NKPALIN-11268.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "spoj.h" 3 | #include 4 | #include 5 | using namespace std ; 6 | 7 | #define NMAX 2200 8 | char s[NMAX],p[NMAX]; 9 | 10 | int main() 11 | { 12 | spoj_init(); 13 | 14 | fscanf(spoj_p_in, "%s", s) ; 15 | int ret; 16 | fscanf(spoj_p_out, "%d", &ret); 17 | 18 | fscanf(spoj_t_out,"%s",p); 19 | spoj_assert(strlen(p)==ret); 20 | for (int i=0; i 2 | #include 3 | #include 4 | 5 | #define maxn 100001 6 | 7 | int a[maxn + 2], b[maxn + 2], c[maxn + 2], n; 8 | char name[100]; 9 | 10 | int main() { 11 | spoj_init(); 12 | 13 | fscanf(spoj_p_in, "%d", &n); 14 | for (int i = 1; i <= n; ++ i) fscanf(spoj_p_in, "%d", &b[i]); 15 | 16 | for (int i = 1; i <= n; ++ i) fscanf(spoj_t_out, "%d", &a[i]); 17 | a[0] = a[n]; 18 | a[n+1] = a[1]; 19 | 20 | bool correct = true; 21 | 22 | for (int i = 1; i <= n; ++ i) { 23 | c[i] = a[i-1] + a[i] + a[i+1]; 24 | if (c[i] != b[i]) correct = false; 25 | } 26 | 27 | spoj_assert(correct); 28 | } 29 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import os 2 | from dotenv import load_dotenv 3 | from discord.ext import commands 4 | 5 | current_path = os.path.dirname(os.path.abspath(__file__)) 6 | os.chdir(current_path) 7 | load_dotenv() 8 | if (os.path.exists("botlogs") == False): 9 | os.mkdir("botlogs") 10 | token = os.getenv('DISCORD_TOKEN') 11 | 12 | # bot 13 | bot = commands.Bot(command_prefix=';rebuild ') 14 | print(bot.command_prefix) 15 | bot.load_extension("cogs.RebuildCommand") 16 | bot.load_extension("cogs.CodeforcesCommand") 17 | bot.load_extension("cogs.BotControlCommand") 18 | bot.load_extension("cogs.CoronaCommand") 19 | @bot.event 20 | async def on_ready(): 21 | print(f'{bot.user.name} has connected to Discord!') 22 | 23 | 24 | @bot.event 25 | async def on_command_error(ctx, error): 26 | print(error) 27 | await ctx.send('Error: ' + str(error)) 28 | 29 | bot.run(token) 30 | -------------------------------------------------------------------------------- /checker/VMCOUNT-8470.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | using namespace std; 20 | const int expect[] = {2241, 61200920, 454553455, 403238471, 10916, 33022, 880639351, 427958180, 953026246, 131751338}; 21 | 22 | int main() 23 | { 24 | spoj_init(); 25 | int score = 0, output; 26 | for (int i = 0; i < 10; i++) 27 | { 28 | fscanf(spoj_t_out, "%d", &output); 29 | if (output == expect[i]) score += 10; 30 | fprintf(spoj_p_info, "%d %d\n", expect[i], output); 31 | } 32 | fprintf(spoj_score, "%d\n", score); 33 | } 34 | -------------------------------------------------------------------------------- /checker/GLOVES-3714.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int L, R, ret, ans, 8 | n, Left[100], Right[100]; 9 | 10 | spoj_init(); 11 | 12 | fscanf(spoj_p_out, "%d%d", &L, &R); 13 | ans = L + R; 14 | 15 | fscanf(spoj_t_out, "%d%d", &L, &R); 16 | ret = L + R; 17 | 18 | spoj_assert(ret == ans); 19 | 20 | fscanf(spoj_p_in, "%d", &n); 21 | for (int i = 1; i <= n; ++i) fscanf(spoj_p_in, "%d", &Left[i]); 22 | for (int i = 1; i <= n; ++i) fscanf(spoj_p_in, "%d", &Right[i]); 23 | 24 | int maxX = (1 << (n-1)); 25 | 26 | for (int x = 0; x <= maxX; ++x) { 27 | int sumL = 0, sumR = 0; 28 | 29 | for (int i = 0; i < n; ++i) 30 | if ( (x >> i) & 1 == 1 ) sumL += Left[i+1]; 31 | else sumR += Right[i+1]; 32 | 33 | spoj_assert(L > sumL || R > sumR); 34 | 35 | } 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /checker/GLOVE-11728.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int L1, R1, L, R, ret, ans, 8 | n, Left[100], Right[100]; 9 | 10 | L1 = -1; 11 | R1 = -1; 12 | L = -1; 13 | R = -1; 14 | 15 | spoj_init(); 16 | 17 | fscanf(spoj_p_out, "%d%d", &L1, &R1); 18 | ans = L1 + R1; 19 | 20 | fscanf(spoj_t_out, "%d%d", &L, &R); 21 | ret = L + R; 22 | 23 | spoj_assert(ret == ans); 24 | 25 | fscanf(spoj_p_in, "%d", &n); 26 | for (int i = 1; i <= n; ++i) fscanf(spoj_p_in, "%d", &Left[i]); 27 | for (int i = 1; i <= n; ++i) fscanf(spoj_p_in, "%d", &Right[i]); 28 | 29 | int maxX = (1 << (n-1)); 30 | 31 | for (int x = 0; x <= maxX; ++x) { 32 | int sumL = 0, sumR = 0; 33 | 34 | for (int i = 0; i < n; ++i) 35 | if ( (x >> i) & 1 == 1 ) sumL += Left[i+1]; 36 | else sumR += Right[i+1]; 37 | 38 | spoj_assert(L > sumL || R > sumR); 39 | 40 | } 41 | 42 | return 0; 43 | } -------------------------------------------------------------------------------- /checker/NKMINES-11355.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std ; 4 | 5 | #define NMAX 220 6 | int a[NMAX][NMAX], b[NMAX][NMAX]; 7 | const int di[]={1,1,1,0,0,-1,-1,-1}; 8 | const int dj[]={-1,0,1,-1,1,-1,0,1}; 9 | 10 | int main() 11 | { 12 | spoj_init(); 13 | 14 | int m, n; 15 | fscanf(spoj_p_in, "%d%d", &m, &n); 16 | for (int i=1; i<=m; i++) 17 | for (int j=1; j<=n; j++) 18 | fscanf(spoj_p_in, "%d", &a[i][j]); 19 | memset(b, 0, sizeof(b)); 20 | for (int i=1; i<=m; i++) 21 | for (int j=1; j<=n; j++) 22 | { 23 | spoj_assert(fscanf(spoj_t_out, "%d", &b[i][j])==1); 24 | spoj_assert(b[i][j]==0 || b[i][j]==1); 25 | } 26 | for (int i=1; i<=m; i++) 27 | for (int j=1; j<=n; j++) 28 | { 29 | int c=0; 30 | for (int d=0; d<8; d++) 31 | c+=b[i+di[d]][j+dj[d]]; 32 | spoj_assert(c==a[i][j]); 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /checker/VMTILE-6968.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) 20 | #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--) 21 | #define REP(i,a) for(int i=0,_a=(a); i<_a; i++) 22 | #define ll long long 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | using namespace std; 28 | const double PI = acos(-1.0); 29 | 30 | #include 31 | 32 | int main() { 33 | spoj_init(); 34 | int score = 0; 35 | REP(i,10) { 36 | int res, student; 37 | fscanf(spoj_p_out, "%d", &res); 38 | fscanf(spoj_t_out, "%d", &student); 39 | if (student == res) score += 10; 40 | } 41 | fprintf(spoj_score, "%d\n", score); 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /checker/VMHEARTS-10845.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | char tmp[100100]; 11 | int main() { 12 | spoj_init(); 13 | 14 | cerr << "Read input" << endl; 15 | spoj_assert(fscanf(spoj_t_out, "%s", &tmp[0]) == 1); 16 | string predicted = string(tmp); 17 | spoj_assert(fscanf(spoj_p_out, "%s", &tmp[0]) == 1); 18 | string expected = string(tmp); 19 | cerr << "Done read input" << endl; 20 | 21 | cerr << "Compute score" << endl; 22 | spoj_assert(predicted.length() == 20000); 23 | spoj_assert(expected.length() == 20000); 24 | double score = 0.0; 25 | for (int i = 0; i < 20000; i++) { 26 | spoj_assert(predicted[i] >= '1' && predicted[i] <= '4'); 27 | if (predicted[i] == expected[i]) { 28 | score++; 29 | } 30 | } 31 | cerr << "Done compute score" << endl; 32 | 33 | score /= 200; 34 | fprintf(spoj_score, "%.2lf\n", score); 35 | cerr << score << endl; 36 | } -------------------------------------------------------------------------------- /problem_set/DP/DP.txt: -------------------------------------------------------------------------------- 1 | QHĐ động chung chung 2 | LAZYCOWS 3 | CP 4 | KINV 5 | EGG 6 | THEME 7 | LIQ 8 | LIS 9 | HAOI5000 10 | LATGACH 11 | DISNEY1 12 | DISNEY2 13 | QBSQUARE 14 | QBPAL 15 | QBCAKE 16 | IVANA 17 | QBDIVSEQ 18 | CUTSEQS 19 | PRETTYP 20 | MAJMUN 21 | SCOLLECT 22 | MCOINS 23 | MDOLLS 24 | MSTRING 25 | LIS2VN 26 | CTNOWN 27 | OWN2 28 | INCVN 29 | FP 30 | MDOSTAVA 31 | MREPLBRC 32 | MFISH 33 | DTDOI 34 | LQDGONME 35 | CTNCLN 36 | XOINC 37 | SPSEQ 38 | DHCAT 39 | EQSTR 40 | CHNTOWER 41 | NKPALIN 42 | NKREZ 43 | NKA1 44 | NKMINERS 45 | NKPOLY 46 | NKTOSS 47 | NKTICK 48 | NKPANO 49 | NKCABLE 50 | LQDBUS 51 | V8SCORE 52 | LEM5 53 | CATGO 54 | VSTEPS 55 | CDMUSIC 56 | VBLOCKS 57 | NKH 58 | TRIBE 59 | LSFIGHT 60 | RECT3 61 | FLOWER 62 | BONES 63 | QUAD 64 | NKSP 65 | XYZ 66 | BARIC 67 | CTNBULLS 68 | DIAMOND 69 | POINTS2 70 | DTTUI2 71 | COMPUTER 72 | FINDNUM 73 | LQDFARM 74 | KCOLLECT 75 | KNMANO 76 | C11BC1 77 | HEADTAIL 78 | TBIKE 79 | VOVAGAME 80 | VOLIS 81 | QTSEQ 82 | C11FBR 83 | RABGAME 84 | VMEMPIRE 85 | QBMAX 86 | MCONVOI 87 | MPILOT 88 | ELEVATOR 89 | COND 90 | HUGEKNAP 91 | NKPATH 92 | PTRANG 93 | PBCDEM 94 | -------------------------------------------------------------------------------- /checker/SLIKAR-3816.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define maxn 1024 5 | 6 | int ret, ans, n, diff, 7 | br[maxn + 1][maxn + 1], ba[maxn + 1][maxn + 1]; 8 | char c; 9 | 10 | int main() { 11 | spoj_init(); 12 | 13 | fscanf(spoj_p_out, "%d\n", &ans); 14 | fscanf(spoj_t_out, "%d\n", &ret); 15 | 16 | spoj_assert(ret == ans); 17 | 18 | fscanf(spoj_p_in, "%d\n", &n); 19 | for (int i = 1; i <= n; ++ i) { 20 | for (int j = 1; j <= n; ++ j) { 21 | fscanf(spoj_p_in, "%c", &c); 22 | ba[i][j] = c - '0'; 23 | } 24 | fscanf(spoj_p_in, "\n"); 25 | } 26 | 27 | for (int i = 1; i <= n; ++ i) { 28 | for (int j = 1; j <= n; ++ j) { 29 | fscanf(spoj_t_out, "%c", &c); 30 | br[i][j] = c - '0'; 31 | } 32 | fscanf(spoj_t_out, "\n"); 33 | } 34 | 35 | diff = 0; 36 | for (int i = 1; i <= n; ++ i) 37 | for (int j = 1; j <= n; ++ j) 38 | if (ba[i][j] != br[i][j]) ++ diff; 39 | 40 | spoj_assert(diff == ret); 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /checker/NKONEARC-11380.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #define NMAX 2200 6 | int n, m; 7 | bool a[2][NMAX][NMAX], dau[NMAX]; 8 | 9 | void dfs(int i, int u) 10 | { 11 | dau[u]=true; 12 | for (int v=1; v<=n; v++) 13 | if (!dau[v] && a[i][u][v]) 14 | dfs(i, v); 15 | } 16 | 17 | int main() 18 | { 19 | spoj_init(); 20 | 21 | memset(a, false, sizeof(a)); 22 | fscanf(spoj_p_in, "%d%d", &n, &m); 23 | for (int i=0; i 2 | //#include 3 | #include 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 10 | #define PIN "in.txt" 11 | #define POUT "ans.txt" 12 | #define TOUT "out.txt" 13 | 14 | void spoj_init() 15 | { 16 | spoj_p_in=fopen(PIN, "r"); 17 | spoj_p_out=fopen(POUT, "r"); 18 | spoj_t_out=fopen(TOUT, "r"); 19 | } 20 | 21 | #define spoj_assert assert*/ 22 | 23 | char a[10010][10010]; 24 | 25 | int main() 26 | { 27 | spoj_init(); 28 | int result, x1; 29 | fscanf(spoj_p_out, "%d", &result); 30 | spoj_assert(fscanf(spoj_t_out, "%d", &x1)==1); 31 | if (result==-1) spoj_assert(result==x1); 32 | else 33 | { 34 | int x2, x3, x4, m, n, x, y; 35 | spoj_assert(fscanf(spoj_t_out, "%d%d%d", &x2, &x3, &x4)==3); 36 | fscanf(spoj_p_in, "%d%d", &n, &m); 37 | spoj_assert(1 <= x1 && x1 <= n); 38 | spoj_assert(1 <= x2 && x2 <= n); 39 | spoj_assert(1 <= x3 && x3 <= n); 40 | spoj_assert(1 <= x4 && x4 <= n); 41 | while (m--) fscanf(spoj_p_in,"%d%d",&x,&y), a[x][y]=a[y][x]=1; 42 | spoj_assert(a[x1][x2] && a[x2][x3] && a[x3][x4] && a[x4][x1]); 43 | } 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /checker/VODONCAY-12481.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int n, h[4000005], ans, cut[4000005],fall[4000005]; 6 | 7 | void readInput() 8 | { 9 | fscanf(spoj_p_in,"%d",&n); 10 | for(int i=1; i<=n; i++) fscanf(spoj_p_in,"%d",&h[i]); 11 | } 12 | void readAnswer() 13 | { 14 | fscanf(spoj_p_out,"%d",&ans); 15 | } 16 | 17 | void Try(int u) 18 | { 19 | fall[u] = 1; 20 | int last = u+h[u]*cut[u]; 21 | for(int i=u+cut[u]; i!=0 && i!=n+1 && i!=last; i+=cut[u]) 22 | { 23 | fall[i] = 1; 24 | spoj_assert(!cut[i]); 25 | int nlast = i+h[i]*cut[u]; 26 | if(cut[u]<0) last = min(last,nlast); 27 | else last = max(last,nlast); 28 | } 29 | } 30 | 31 | void readOutput() 32 | { 33 | int res,x; 34 | spoj_assert(fscanf(spoj_t_out,"%d",&res)==1); 35 | spoj_assert(res<=ans); 36 | for(int i=1; i<=res; i++) 37 | { 38 | spoj_assert(fscanf(spoj_t_out,"%d",&x)==1); 39 | spoj_assert(abs(x)>=1 && abs(x)<=n); 40 | cut[abs(x)] = x/abs(x); 41 | } 42 | for(int i=1; i<=n; i++) 43 | if(cut[i]) Try(i); 44 | for(int i=1; i<=n; i++) 45 | spoj_assert(fall[i]); 46 | } 47 | int main() 48 | { 49 | spoj_init(); 50 | readInput(); 51 | readAnswer(); 52 | readOutput(); 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /checker/V8SCORE-11353.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "spoj.h" 3 | using namespace std; 4 | 5 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 6 | #define PIN "in.txt" 7 | #define POUT "ans.txt" 8 | #define TOUT "out.txt" 9 | 10 | void spoj_init() 11 | { 12 | spoj_p_in=fopen(PIN, "r"); 13 | spoj_p_out=fopen(POUT, "r"); 14 | spoj_t_out=fopen(TOUT, "r"); 15 | } 16 | void spoj_assert(bool b) 17 | { 18 | if (!b) 19 | { 20 | printf("WA"); 21 | exit(1); 22 | } 23 | }*/ 24 | 25 | int main() 26 | { 27 | spoj_init(); 28 | 29 | char ans[100], ret[100]; 30 | fscanf(spoj_p_out, "%s", ans); 31 | spoj_assert(fscanf(spoj_t_out, "%s", ret)==1); 32 | spoj_assert(strcmp(ans, ret)==0); 33 | if (strcmp(ans, "YES")==0) 34 | { 35 | int s, k, n; 36 | fscanf(spoj_p_in, "%d%d%d", &s, &k, &n); 37 | int a[30][30]; 38 | for (int i=0; i=x); 47 | x=y; 48 | bool b=false; 49 | for (int i=0; i 2 | #include "spoj.h" 3 | using namespace std; 4 | 5 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 6 | #define PIN "in.txt" 7 | #define POUT "ans.txt" 8 | #define TOUT "out.txt" 9 | 10 | void spoj_init() 11 | { 12 | spoj_p_in=fopen(PIN, "r"); 13 | spoj_p_out=fopen(POUT, "r"); 14 | spoj_t_out=fopen(TOUT, "r"); 15 | } 16 | void spoj_assert(bool b) 17 | { 18 | if (!b) 19 | { 20 | printf("WA"); 21 | exit(1); 22 | } 23 | }*/ 24 | 25 | #define NMAX 210 26 | int a[NMAX][NMAX]; 27 | int n, m; 28 | 29 | int main() 30 | { 31 | spoj_init(); 32 | 33 | memset(a, 0, sizeof(a)); 34 | fscanf(spoj_p_in, "%d%d", &n, &m); 35 | for (int i=0; i0); 55 | a[u][v]--; 56 | a[v][u]--; 57 | u=v; 58 | } 59 | } 60 | return 0; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /checker/NKTARDY-11378.cpp: -------------------------------------------------------------------------------- 1 | //#include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 7 | #define PIN "in.txt" 8 | #define POUT "ans.txt" 9 | #define TOUT "out.txt" 10 | 11 | void spoj_init() 12 | { 13 | spoj_p_in=fopen(PIN, "r"); 14 | spoj_p_out=fopen(POUT, "r"); 15 | spoj_t_out=fopen(TOUT, "r"); 16 | } 17 | void spoj_assert(bool b) 18 | { 19 | if (!b) 20 | { 21 | printf("WA"); 22 | exit(1); 23 | } 24 | }*/ 25 | 26 | #define NMAX 102000 27 | int p[NMAX], d[NMAX]; 28 | bool dau[NMAX]; 29 | 30 | int main() 31 | { 32 | spoj_init(); 33 | 34 | int n, ans, ret; 35 | fscanf(spoj_p_out, "%d", &ans); 36 | spoj_assert(fscanf(spoj_t_out, "%d", &ret)==1); 37 | spoj_assert(ret==ans); 38 | fscanf(spoj_p_in, "%d", &n); 39 | for (int i=1; i<=n; i++) 40 | fscanf(spoj_p_in, "%d", &p[i]); 41 | for (int i=1; i<=n; i++) 42 | fscanf(spoj_p_in, "%d", &d[i]); 43 | int t=0, c=0; 44 | memset(dau, false, sizeof(dau)); 45 | for (int i=1; i<=n; i++) 46 | { 47 | int x; 48 | spoj_assert(fscanf(spoj_t_out, "%d", &x)==1); 49 | spoj_assert(1<=x && x<=n); 50 | spoj_assert(!dau[x]); 51 | dau[x]=true; 52 | t+=p[x]; 53 | if (t>d[x]) 54 | c++; 55 | } 56 | spoj_assert(c==ans); 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /checker/VM3PHIA-5978.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | /* 11 | FILE *spoj_p_in, *spoj_t_out, *spoj_score; 12 | #define PIN "1.in" 13 | #define TOUT "ac.txt" 14 | #define SCORE "result.txt" 15 | 16 | void spoj_init() 17 | { 18 | spoj_p_in=fopen(PIN, "r"); 19 | spoj_t_out=fopen(TOUT, "r"); 20 | spoj_score=fopen(SCORE, "w"); 21 | } 22 | 23 | #define spoj_assert assert 24 | */ 25 | 26 | int main() { 27 | spoj_init(); 28 | 29 | int c[222][222]; 30 | char s[222]; 31 | int n, m; 32 | memset(c, 0, sizeof(c)); 33 | 34 | fscanf(spoj_p_in, "%d%d", &n, &m); 35 | for (int i = 0; i < m; i++) { 36 | int u, v; 37 | fscanf(spoj_p_in, "%d%d", &u, &v); 38 | c[u][v] = c[v][u] = 1; 39 | } 40 | 41 | for (int i = 1; i <= n; i++) { 42 | spoj_assert(fscanf(spoj_t_out, "%c", &s[i]) == 1); 43 | spoj_assert('1' <= s[i] && s[i] <= '3'); 44 | } 45 | 46 | for (int i = 1; i <= n; i++) 47 | for (int j = 1; j <= n; j++) if (c[i][j] == 1) 48 | spoj_assert(s[i] != s[j]); 49 | 50 | int cnt[5]; 51 | memset(cnt, 0, sizeof(cnt)); 52 | for (int i = 1; i <= n; i++) cnt[s[i] - '0']++; 53 | spoj_assert(cnt[1] > 0 && cnt[2] > 0 && cnt[3] > 0); 54 | 55 | fprintf(spoj_score, "5"); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /checker/PCYCLE-3369.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std ; 7 | 8 | #define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();it++) 9 | #define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++) 10 | #define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--) 11 | #define REP(i,n) for( int i=0,_n=(n);i<_n;i++) 12 | #define DEP(i,n) for( int i=(n)-1;i>=0;i--) 13 | 14 | int edge[205][205] ; 15 | int n, m, start, solution ; 16 | 17 | main() 18 | { 19 | spoj_init() ; 20 | fscanf(spoj_t_out,"%d",&start) ; 21 | fscanf(spoj_p_out,"%d",&solution) ; 22 | spoj_assert( start * solution > 0 ) ; 23 | if ( solution == -1 ) return 0 ; 24 | fscanf(spoj_p_in,"%d %d",&n,&m) ; 25 | FOR(u,1,n) 26 | FOR(v,1,n) edge[u][v] = 100000000 ; 27 | REP(i,m) { 28 | int u, v, val ; 29 | fscanf(spoj_p_in,"%d %d %d",&u,&v,&val) ; 30 | edge[u][v] = edge[v][u] = val ; 31 | } 32 | 33 | int u = start ; 34 | int tong = 0 ; 35 | REP(i,m) { 36 | int v ; 37 | fscanf(spoj_t_out,"%d",&v) ; 38 | spoj_assert( v > 0 && v <= n ) ; 39 | spoj_assert( edge[u][v] <= 10000 ) ; 40 | tong += edge[u][v] ; 41 | edge[v][u] = edge[u][v] = 10001 ; 42 | spoj_assert( tong >= 0 ) ; 43 | u = v ; 44 | } 45 | 46 | spoj_assert( start == u ) ; 47 | FOR(u,1,n) 48 | FOR(v,1,n) spoj_assert( edge[u][v] > 10000 ) ; 49 | return 0 ; 50 | } 51 | -------------------------------------------------------------------------------- /checker/KBOMB-5980.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | /* 11 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 12 | #define PIN "input.txt" 13 | #define POUT "answer.txt" 14 | #define TOUT "output.txt" 15 | #define SCORE "result.txt" 16 | 17 | void spoj_init() 18 | { 19 | spoj_p_in=fopen(PIN, "r"); 20 | spoj_p_out=fopen(POUT, "r"); 21 | spoj_t_out=fopen(TOUT, "r"); 22 | spoj_score=fopen(SCORE, "w"); 23 | } 24 | 25 | #define spoj_assert assert 26 | */ 27 | 28 | int main() { 29 | spoj_init(); 30 | 31 | int c[111111]; 32 | int m; 33 | memset(c, 0, sizeof(c)); 34 | 35 | fscanf(spoj_p_out, "%d", &m); 36 | for (int i = 0; i < m; i++) { 37 | int x; 38 | fscanf(spoj_p_out, "%d", &x); 39 | c[x]++; 40 | } 41 | 42 | spoj_assert(fscanf(spoj_t_out, "%d", &m)==1); 43 | for (int i = 0; i < m; i++) { 44 | int x; 45 | spoj_assert(fscanf(spoj_t_out, "%d", &x) == 1); 46 | c[x]--; 47 | } 48 | 49 | for (int i = 0; i < 111111; i++) 50 | spoj_assert(c[i] == 0); 51 | 52 | int score = 2; 53 | 54 | double ans, out; 55 | ans = out = -1; 56 | fscanf(spoj_p_out, "%lf", &ans); 57 | fscanf(spoj_t_out, "%lf", &out); 58 | if (abs(ans - out) < 0.000001) score+=2; 59 | 60 | fprintf(spoj_score, "%d", score); 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /checker/VMMTFIVE-5972.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | /* 11 | FILE *spoj_p_in, *spoj_t_out, *spoj_score; 12 | #define PIN "input.txt" 13 | #define TOUT "wrong2.txt" 14 | #define SCORE "result.txt" 15 | 16 | void spoj_init() 17 | { 18 | spoj_p_in=fopen(PIN, "r"); 19 | spoj_t_out=fopen(TOUT, "r"); 20 | spoj_score=fopen(SCORE, "w"); 21 | } 22 | 23 | #define spoj_assert assert 24 | */ 25 | 26 | int main() { 27 | spoj_init(); 28 | 29 | int row[5], column[5], a[5][5]; 30 | for (int i = 0; i < 5; i++) 31 | fscanf(spoj_p_in, "%d", &row[i]); 32 | for (int i = 0; i < 5; i++) 33 | fscanf(spoj_p_in, "%d", &column[i]); 34 | 35 | for (int i = 0; i < 5; i++) 36 | for (int j = 0; j < 5; j++) 37 | spoj_assert(fscanf(spoj_t_out, "%d", &a[i][j]) == 1); 38 | 39 | for (int i = 0; i < 5; i++) 40 | for (int j = 0; j < 5; j++) 41 | spoj_assert(((1<=a[j][j])&&(a[i][j]<=25))); 42 | 43 | for (int i = 0; i < 5; i++) { 44 | int sum = 0; 45 | for (int j = 0; j < 5; j++) sum += a[i][j]; 46 | spoj_assert(sum == row[i]); 47 | } 48 | 49 | for (int j = 0; j < 5; j++) { 50 | int sum = 0; 51 | for (int i = 0; i < 5; i++) sum += a[i][j]; 52 | spoj_assert(sum == column[j]); 53 | } 54 | 55 | fprintf(spoj_score, "5"); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /checker/INFORMAC-7629.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | #include 4 | 5 | #define foru(i,a,b) for(int i = int(a); i <= int(b); ++i) 6 | #define ford(i,b,a) for(int i = int(b); i >= int(a); --i) 7 | #define rep(i, n) for(int i = 0; i < int(n); ++i) 8 | #define all(a) a.begin(),a.end() 9 | #define size(a) int(a.size()) 10 | #define fill(a,x) memset(a, (x), sizeof(a)) 11 | 12 | 13 | const int MAX_N = 222; 14 | int a[MAX_N], b[MAX_N]; 15 | 16 | int main() 17 | { 18 | spoj_init(); 19 | 20 | /* Check for AC */ 21 | 22 | fscanf(spoj_p_out, "%d", &a[1]); 23 | fscanf(spoj_t_out, "%d", &b[1]); 24 | if (a[1] == -1 || b[1] == -1) return int(a[1] != b[1]); 25 | 26 | int n, m; 27 | fscanf(spoj_p_in, "%d%d", &n,&m); 28 | foru(i,2,n) fscanf(spoj_t_out, "%d", &b[i]); 29 | 30 | foru(i,1,n) { 31 | if (b[i] < 1 || b[i] > n) return 1; 32 | foru(j,i+1,n) 33 | if (b[i] == b[j]) return 1; 34 | } 35 | 36 | rep(id,m) { 37 | int t,x,y,v; 38 | fscanf(spoj_p_in, "%d%d%d%d", &t,&x,&y,&v); 39 | if (t == 1) { 40 | bool ok = false; 41 | for(int i = x; i <= y; ++i) 42 | if (b[i] > v) return 1; 43 | else if (b[i] == v) ok = true; 44 | if (!ok) return 1; 45 | } 46 | else { 47 | bool ok = false; 48 | for(int i = x; i <= y; ++i) 49 | if (b[i] < v) return 1; 50 | else if (b[i] == v) ok = true; 51 | if (!ok) return 1; 52 | } 53 | } 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /checker/VMKREIS-10927.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj_interactive.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | 11 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score, *spoj_for_tested; 12 | #define PIN "input.txt" 13 | #define POUT "output.txt" 14 | #define TOUT "wrong2.txt" 15 | #define SCORE "result.txt" 16 | 17 | void spoj_init() { 18 | spoj_p_in=fopen(PIN, "r"); 19 | spoj_p_out=fopen(POUT, "r"); 20 | spoj_t_out=fopen(TOUT, "r"); 21 | spoj_score=fopen(SCORE, "w"); 22 | } 23 | 24 | #define spoj_assert assert 25 | #define spoj_scanf scan 26 | #define spoj_printf printf 27 | #define SPOJ_RV_AC 0 28 | #define SPOJ_RV_WA 1 29 | #define spoj_for_tested stdout */ 30 | 31 | double w, h, r, x, y; 32 | double xr, yr, rr, score; 33 | int ext, mode, count; 34 | bool rep; 35 | 36 | double sqr(double x) { 37 | return x*x; 38 | } 39 | 40 | int main(){ 41 | spoj_init(); 42 | fscanf(spoj_p_in,"%lf %lf %d",&w,&h,&ext); //read input 43 | fscanf(spoj_p_out,"%lf %lf %lf",&x,&y,&r); //read output 44 | count=0; 45 | score=5; 46 | 47 | //fscanf(spoj_t_out,"%d",&mode); 48 | spoj_scanf("%d",&mode); 49 | //fscanf(spoj_t_out,"%lf %lf %lf",&xr,&yr,&rr); 50 | //spoj_assert(abs(xr-x)<=0.01 && abs(yr-y)<=0.01 && abs(rr-r)<=0.01); 51 | if (count <= ext) score=5; 52 | else if (count <= 2*ext) score = (double)5* (1-(score-ext)/100); 53 | else score=0; 54 | fprintf(spoj_score, "%.2lf\n",score); 55 | return SPOJ_RV_AC; 56 | } 57 | -------------------------------------------------------------------------------- /checker/NKNET-11379.cpp: -------------------------------------------------------------------------------- 1 | //#include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 7 | #define PIN "in.txt" 8 | #define POUT "ans.txt" 9 | #define TOUT "out.txt" 10 | 11 | void spoj_init() 12 | { 13 | spoj_p_in=fopen(PIN, "r"); 14 | spoj_p_out=fopen(POUT, "r"); 15 | spoj_t_out=fopen(TOUT, "r"); 16 | } 17 | void spoj_assert(bool b) 18 | { 19 | if (!b) 20 | { 21 | printf("WA"); 22 | exit(1); 23 | } 24 | }*/ 25 | 26 | #define NMAX 220 27 | int a[NMAX][NMAX]; 28 | int n; 29 | bool dau[NMAX]; 30 | 31 | void dfs(int u) 32 | { 33 | dau[u]=true; 34 | for (int v=1; v<=n; v++) 35 | if (!dau[v] && a[u][v]>0) 36 | dfs(v); 37 | } 38 | 39 | int main() 40 | { 41 | spoj_init(); 42 | 43 | int s, t, m; 44 | fscanf(spoj_p_in,"%d%d",&n,&m); 45 | memset(a,0,sizeof(a)); 46 | for (int i=0; i0); 62 | cret=max(cret,a[u][v]); 63 | a[u][v]=a[v][u]=0; 64 | } 65 | spoj_assert(cans==cret); 66 | memset(dau, false, sizeof(dau)); 67 | dfs(s); 68 | spoj_assert(!dau[t]); 69 | 70 | return 0; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /checker/PETROLM-11082.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | 11 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 12 | #define PIN "input.txt" 13 | #define POUT "output.txt" 14 | #define TOUT "wrong2.txt" 15 | #define SCORE "result.txt" 16 | 17 | void spoj_init() 18 | { 19 | spoj_p_in=fopen(PIN, "r"); 20 | spoj_p_out=fopen(POUT, "r"); 21 | spoj_t_out=fopen(TOUT, "r"); 22 | spoj_score=fopen(SCORE, "w"); 23 | } 24 | 25 | #define spoj_assert assert */ 26 | 27 | #define foru(i,l,r) for(int i=l; i<=r; i++) 28 | #define maxn 5000 29 | 30 | int n, m; 31 | int a[maxn], b[maxn]; 32 | bool selected[maxn]; 33 | long long res; 34 | 35 | void read_input_output(){ 36 | fscanf(spoj_p_in,"%d",&n); 37 | foru(i,1,n) fscanf(spoj_p_in,"%d",&a[i]); 38 | 39 | fscanf(spoj_p_in,"%d",&m); 40 | foru(i,1,m) fscanf(spoj_p_in,"%d",&b[i]); 41 | 42 | fscanf(spoj_p_out,"%lld",&res); 43 | } 44 | 45 | void read_answer(){ 46 | long long ans; 47 | spoj_assert(fscanf(spoj_t_out,"%lld",&ans)==1); 48 | spoj_assert(ans == res); 49 | long long sum=0; 50 | int j; 51 | fill(selected,selected+m+10,0); 52 | foru(i,1,n){ 53 | spoj_assert(fscanf(spoj_t_out,"%d",&j)==1); 54 | spoj_assert(j>0 && j<=m); 55 | selected[j] = 1; 56 | sum += abs(a[i]-b[j]); 57 | } 58 | 59 | spoj_assert(sum == res); 60 | foru(i,1,m) spoj_assert(selected[i] == 1); 61 | } 62 | 63 | int main(){ 64 | spoj_init(); 65 | read_input_output(); 66 | read_answer(); 67 | fprintf(spoj_score, "%lf",(double)5/3); 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /helper/helper.py: -------------------------------------------------------------------------------- 1 | import json 2 | __PREFIX__ = 'VOJ-' 3 | 4 | 5 | def get_commit_state(problems): 6 | res = {} 7 | for problem in problems: 8 | name = problem['name'].upper() 9 | if __PREFIX__ and name.find(__PREFIX__) == -1: 10 | continue 11 | number_commit = int(problem['revision']) 12 | res[name] = number_commit 13 | return res 14 | 15 | 16 | def get_problem_name_id(problems): 17 | res = {} 18 | for problem in problems: 19 | name = problem['name'].upper() 20 | if __PREFIX__ and name.find(__PREFIX__) == -1: 21 | continue 22 | id = int(problem['id']) 23 | if name in res: 24 | if problem['owner'] == 'tuvietthao': 25 | continue 26 | 27 | res[name] = id 28 | return res 29 | 30 | 31 | def time_format(seconds): 32 | seconds = int(seconds) 33 | days, seconds = divmod(seconds, 86400) 34 | hours, seconds = divmod(seconds, 3600) 35 | minutes, seconds = divmod(seconds, 60) 36 | return days, hours, minutes, seconds 37 | 38 | 39 | def pretty_time_format(seconds): 40 | days, hours, minutes, seconds = time_format(seconds) 41 | timespec = [ 42 | (days, 'day', 'days'), 43 | (hours, 'hour', 'hours'), 44 | (minutes, 'minute', 'minutes'), 45 | (seconds, 'second', 'seconds') 46 | ] 47 | timeprint = [(cnt, singular, plural) for cnt, singular, plural in timespec if cnt] 48 | 49 | def format_(triple): 50 | cnt, singular, plural = triple 51 | return f'{cnt} {singular if cnt == 1 else plural}' 52 | 53 | return ' '.join(map(format_, timeprint)) 54 | -------------------------------------------------------------------------------- /checker/VOBOARD3-9853.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | char a[1010][1010]; 6 | int m, n, used[1010][1010], flip[1010][1010]; 7 | 8 | void readInput() 9 | { 10 | spoj_assert(fscanf(spoj_p_in, "%d %d", &m ,&n) == 2); 11 | spoj_assert(n >= 1 && n <= 1000); 12 | spoj_assert(m >= 1 && m <= 1000); 13 | 14 | for (int i = 1; i <= m; i++) 15 | { 16 | spoj_assert(fscanf(spoj_p_in, "%s", a[i] + 1) == 1); 17 | for (int j = 1; j <= n; j++) 18 | spoj_assert(a[i][j] == '0' || a[i][j] == '1'); 19 | } 20 | } 21 | 22 | void readOutput() 23 | { 24 | int steps; 25 | spoj_assert(fscanf(spoj_t_out, "%d", &steps) == 1); 26 | 27 | int x, y, xx, yy, r, c; 28 | while (fscanf(spoj_t_out, "%d %d %d %d", &x, &y, &r, &c) == 4) 29 | { 30 | spoj_assert(--steps >= 0); 31 | 32 | spoj_assert(r > 0 && r <= m); 33 | spoj_assert(c > 0 && c <= n); 34 | spoj_assert(used[r][c] == 0); 35 | used[r][c] = 1; 36 | 37 | xx = x + r - 1; 38 | yy = y + c - 1; 39 | 40 | spoj_assert(x > 0 && x <= m); 41 | spoj_assert(xx > 0 && xx <= m); 42 | spoj_assert(y > 0 && y <= n); 43 | spoj_assert(yy > 0 && yy <= n); 44 | 45 | flip[x][y] ^= 1; 46 | flip[x][yy + 1] ^= 1; 47 | flip[xx + 1][y] ^= 1; 48 | flip[xx + 1][yy + 1] ^= 1; 49 | } 50 | 51 | spoj_assert(steps == 0); 52 | 53 | for (int i = 1; i <= m; i++) 54 | for (int j = 1; j <= n; j++) 55 | { 56 | flip[i][j] ^= flip[i - 1][j] ^ flip[i][j - 1] ^ flip[i - 1][j - 1]; 57 | spoj_assert(flip[i][j] == a[i][j] - '0'); 58 | } 59 | } 60 | 61 | int main() 62 | { 63 | spoj_init(); 64 | readInput(); 65 | readOutput(); 66 | fprintf(spoj_score, "5"); 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /checker/HEADTAIL-6262.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | /* 12 | FILE *spoj_p_in, *spoj_t_out, *spoj_p_out, *spoj_score; 13 | 14 | #define PIN "in.txt" 15 | #define TOUT "out.txt" 16 | #define POUT "ans.txt" 17 | #define SCORE "score.txt" 18 | #define spoj_assert assert 19 | 20 | void spoj_init() 21 | { 22 | spoj_p_in=fopen(PIN, "r"); 23 | spoj_t_out=fopen(TOUT, "r"); 24 | spoj_p_out=fopen(POUT, "r"); 25 | spoj_score=fopen(SCORE, "w"); 26 | } 27 | */ 28 | 29 | string expected[4]; 30 | string output[4]; 31 | 32 | void read_ans() { 33 | int t; 34 | fscanf(spoj_p_out, "%d", &t); 35 | while (t--) { 36 | int tmp1; 37 | char tmp2[10000]; 38 | fscanf(spoj_p_out, "%d", &tmp1); 39 | fscanf(spoj_p_out, "%s", &tmp2); 40 | expected[tmp1] = tmp2; 41 | } 42 | } 43 | 44 | void read_out() { 45 | for (int i = 0; i < 4; i++) output[i] = "#"; 46 | 47 | int t; 48 | spoj_assert(fscanf(spoj_t_out, "%d", &t) == 1); 49 | while (t--) { 50 | int tmp1; 51 | char tmp2[10000]; 52 | spoj_assert(fscanf(spoj_t_out, "%d", &tmp1) == 1); 53 | spoj_assert(fscanf(spoj_t_out, "%s", &tmp2) == 1); 54 | spoj_assert(output[tmp1] == "#"); 55 | output[tmp1] = tmp2; 56 | } 57 | } 58 | 59 | int main() { 60 | spoj_init(); 61 | read_ans(); 62 | read_out(); 63 | // cout << expected[1] << " " << expected[2] << endl; 64 | // cout << output[1] << " " << output[2] << endl; 65 | int score = 0; 66 | if (expected[1] == output[1]) score += 4; 67 | if (expected[2] == output[2]) score += 1; 68 | 69 | fprintf(spoj_score, "%d", score); 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /checker/VM15SWAP-12256.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Allow max swap is 10^5 3 | */ 4 | 5 | #include "spoj.h" 6 | #include 7 | using namespace std; 8 | 9 | const int MAXN = 1000 + 5; 10 | int a[MAXN][MAXN]; 11 | int row_id[MAXN], col_id[MAXN]; 12 | int m,n; 13 | int MAX_SWAP = (int)1e5; 14 | 15 | int main(){ 16 | spoj_init(); 17 | 18 | //input the board; 19 | fscanf(spoj_p_in, "%d%d", &m, &n); 20 | for(int i=1; i<=m; ++i) 21 | for(int j=1; j<=n; ++j) 22 | fscanf(spoj_p_in, "%d", &a[i][j]); 23 | 24 | //init row_id, col_id 25 | for(int i=1; i<=m; ++i) row_id[i] = i; 26 | for(int j=1; j<=n; ++j) col_id[j] = j; 27 | 28 | //solution x0, y0 29 | int sol_x0, sol_y0; 30 | fscanf(spoj_p_out, "%d %d", &sol_x0, &sol_y0); 31 | 32 | //Check output x0, y0 33 | int x0, y0; 34 | spoj_assert(fscanf(spoj_t_out, "%d %d\n", &x0, &y0)==2); 35 | spoj_assert(0<=x0 && x0<=m && 0<=y0 && y0<=n); 36 | spoj_assert(x0+y0 == sol_x0+sol_y0); 37 | if (sol_x0==0 && sol_y0==0){ 38 | fprintf(spoj_score, "1"); 39 | return 0; 40 | } 41 | 42 | //Check swap 43 | int num_swap; 44 | spoj_assert(fscanf(spoj_t_out, "%d\n", &num_swap)==1); 45 | spoj_assert(0<=num_swap && num_swap<=MAX_SWAP); 46 | while(num_swap--){ 47 | char c; int i, j; 48 | spoj_assert(fscanf(spoj_t_out,"%c %d %d\n", &c, &i, &j)==3); 49 | spoj_assert(c=='R' || c=='C'); 50 | if (c=='R'){ 51 | spoj_assert(1<=i && i<=m && 1<=j && j<=m); 52 | swap(row_id[i], row_id[j]); 53 | } 54 | else { 55 | spoj_assert(1<=i && i<=n && 1<=j && j<=n); 56 | swap(col_id[i], col_id[j]); 57 | } 58 | } 59 | 60 | //Check board after swap 61 | for(int i=1; i<=x0; ++i) 62 | for(int j=1; j<=y0; ++j) 63 | spoj_assert( a[row_id[i]][col_id[j]] == 1 ); 64 | 65 | fprintf(spoj_score, "1"); 66 | return 0; 67 | } -------------------------------------------------------------------------------- /checker/NKTRIO-4019.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int n, a[1005][1005], x, y, z, deg[1005], q[1005]; 6 | bool exist[1005][1005], correct; 7 | 8 | bool cycle() { 9 | for (int i = 1; i <= n; ++ i) deg[i] = 0; 10 | 11 | for (int i = 1; i <= n; ++ i) 12 | for (int j = 1; j <= n; ++ j) 13 | if (a[i][j] == 1) { 14 | exist[i][j] = true; 15 | ++ deg[j]; 16 | } 17 | else exist[i][j] = false; 18 | 19 | int fi = 1, la = 0; 20 | for (int i = 1; i <= n; ++ i) 21 | if (deg[i] == 0) q[++ la] = i; 22 | while (fi <= la) { 23 | int i = q[fi ++]; 24 | for (int j = 1; j <= n; ++ j) 25 | if (a[i][j] == 1 && exist[i][j]) { 26 | exist[i][j] = false; 27 | -- deg[j]; 28 | if (deg[j] == 0) q[++ la] = j; 29 | } 30 | } 31 | 32 | for (int i = 1; i <= n; ++ i) 33 | for (int j = 1; j <= n; ++ j) 34 | if (exist[i][j]) return true; 35 | return false; 36 | } 37 | 38 | int main() { 39 | spoj_init(); 40 | 41 | fscanf(spoj_p_in, "%d", &n); 42 | for (int i = 1; i <= n; ++ i) 43 | for (int j = 1; j <= n; ++ j) fscanf(spoj_p_in, "%d", &a[i][j]); 44 | 45 | x = y = z = -5; 46 | fscanf(spoj_t_out, "%d%d%d", &x, &y, &z); 47 | 48 | if (x == -1 && y == -1 && z == -1) { 49 | if (cycle()) correct = false; 50 | else correct = true; 51 | } 52 | else { 53 | if (x < 1 || x > n || y < 1 || y > n || z < 1 || z > n) correct = false; 54 | else correct = (a[x][y] == 1 && a[y][z] == 1 && a[z][x] == 1); 55 | } 56 | 57 | spoj_assert(correct); 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VOJ-rebuild-bot 2 | A discord bot which helps speed up migration VOJ problems to Codeforces by using polygon, codeforces APIs. 3 | 4 | ## Features 5 | ### Polygon 6 | - Give permission access of a (list of) problem(s) to other users. 7 | 8 | ### Codeforces 9 | - Create new mashup using polygon links 10 | - Edit mashup information 11 | - Run package solutions 12 | - Add mashup contest to a codeforces group 13 | 14 | ### Other 15 | - Manage: 16 | - Staff list 17 | - Problems list: see doing problems, deleted problems, reviewed problems ... 18 | - Some git commands to update the bot. 19 | - Some commands about nCoVi virus. 20 | 21 | ## Installation 22 | Clone this repository 23 | - `python pip install -r requirements` 24 | - Base on file `.env-example`, create file `.env` and fill all the data: bot token, account polygon (for polygon commands), account codeforces (for codeforces commands), ... 25 | 26 | ## How to use 27 | - Create a discord bot, add it to your discord server. 28 | - Then use `python main.py` to run the bot. Remember to edit data in `.env`. 29 | - Use `;rebuild help` to see list command 30 | 31 | ## Notes 32 | - There is some commands required `Admin` role. If you're not bot's owner, you will need `Admin` role to use those commands. 33 | - You can update the bot (get new commit from this repository) by using `;rebuild git_pull` command. Then you can use `;rebuild restart` to restart the bot (you don't need to run it again, it's very useful since I'm running the bot in a VPS). 34 | 35 | ## About the APIs 36 | Since the bot doesn't need many APIs, I didn't add all the API I have into [services](/services) but I'll upload it soon (in an other repository). 37 | 38 | Currently, for polygon APIs, you can see [this repository](https://github.com/t-rekttt/polygon-api/tree/master/built) (written in nodejs). 39 | -------------------------------------------------------------------------------- /checker/TORCH-3402.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | #include 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | /* 10 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 11 | #define PIN "in.txt" 12 | #define POUT "ans.txt" 13 | #define TOUT "out.txt" 14 | #define SCORE "result.txt" 15 | 16 | void spoj_init() 17 | { 18 | spoj_p_in=fopen(PIN, "r"); 19 | spoj_p_out=fopen(POUT, "r"); 20 | spoj_t_out=fopen(TOUT, "r"); 21 | spoj_score=fopen(SCORE, "w"); 22 | } 23 | 24 | #define spoj_assert assert 25 | */ 26 | double expectedResult; 27 | double result; 28 | int n; 29 | double x[111], y[111]; 30 | int p[111]; 31 | 32 | int main() 33 | { 34 | spoj_init(); 35 | //Doc ans 36 | fscanf(spoj_p_out, "%lf", &expectedResult); 37 | //Doc in 38 | fscanf(spoj_p_in, "%d", &n); 39 | for (int i = 1; i <= n; i++) fscanf(spoj_p_in, "%lf%lf", &x[i], &y[i]); 40 | 41 | spoj_assert( fscanf(spoj_t_out, "%lf", &result) == 1); 42 | for (int i = 1; i <= n; i++) 43 | spoj_assert( fscanf(spoj_t_out, "%d", &p[i]) ); 44 | for (int i = 1; i <= n; i++) 45 | for (int j = i + 1; j <= n; j++) spoj_assert(p[i] != p[j]); 46 | spoj_assert(p[1] == 1); 47 | p[n + 1] = 1; 48 | for (int i = 1; i <= n; i++) 49 | spoj_assert(1 <= p[i] && p[i] <= n); 50 | 51 | double s = 0; 52 | for (int i = 1; i <= n; i++) { 53 | int u = p[i]; 54 | int v = p[i + 1]; 55 | s += pow(pow(x[u] - x[v], 2) + pow(y[u] - y[v], 2), 0.5); 56 | } 57 | spoj_assert(abs(s - result) <= 0.0005); 58 | if (s <= expectedResult + 1e-4) { 59 | fprintf(spoj_score, "10"); 60 | } else { 61 | if (result > expectedResult * 1.5) fprintf(spoj_score, "0"); 62 | else { 63 | double score = 9 - pow(1.5, ((result - expectedResult) / 25)); 64 | if (score < 0) score = 0; 65 | 66 | fprintf(spoj_score, "%0.6lf", score); 67 | } 68 | } 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /checker/WIFI-3406.cpp: -------------------------------------------------------------------------------- 1 | #define sqr(x) ((x) * (x)) 2 | 3 | #include 4 | //#include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | using namespace std; 12 | 13 | /* 14 | FILE *spoj_p_in, *spoj_t_out, *spoj_p_out; 15 | #define PIN "in.txt" 16 | #define TOUT "out.txt" 17 | #define POUT "ans.txt" 18 | #define spoj_assert assert 19 | 20 | void spoj_init() 21 | { 22 | spoj_p_in=fopen(PIN, "r"); 23 | spoj_t_out=fopen(TOUT, "r"); 24 | spoj_p_out=fopen(POUT, "r"); 25 | } 26 | */ 27 | 28 | int cx[333]; 29 | int cy[333]; 30 | int ax[333]; 31 | int ay[333]; 32 | int m, n; 33 | int expected; 34 | int result; 35 | int connect[333]; 36 | int cnt[333]; 37 | 38 | void read_in() { 39 | fscanf(spoj_p_in, "%d%d", &m, &n); 40 | for (int i = 1; i <= m; i++) { 41 | fscanf(spoj_p_in, "%d%d", &ax[i], &ay[i]); 42 | } 43 | for (int i = 1; i <= n; i++) { 44 | fscanf(spoj_p_in, "%d%d", &cx[i], &cy[i]); 45 | } 46 | } 47 | 48 | void read_ans() { 49 | fscanf(spoj_p_out, "%d", &expected); 50 | } 51 | 52 | void read_out() { 53 | spoj_assert(fscanf(spoj_t_out, "%d", &result) == 1); 54 | for (int i = 1; i <= n; i++) { 55 | spoj_assert(fscanf(spoj_t_out, "%d", &connect[i]) == 1); 56 | } 57 | } 58 | 59 | int main() { 60 | spoj_init(); 61 | read_in(); 62 | read_ans(); 63 | read_out(); 64 | spoj_assert(expected == result); 65 | for (int i = 1; i <= n; i++) 66 | spoj_assert(1 <= connect[i] && connect[i] <= m); 67 | for (int i = 1; i <= n; i++) { 68 | int j = connect[i]; 69 | int s = sqr(cx[i] - ax[j]) + sqr(cy[i] - ay[j]); 70 | result -= s; 71 | } 72 | spoj_assert(result == 0); 73 | memset(cnt, 0, sizeof(cnt)); 74 | for (int i = 1; i <= n; i++) cnt[connect[i]]++; 75 | for (int i = 1; i <= m; i++) 76 | for (int j = 1; j <= m; j++) 77 | spoj_assert(abs(cnt[i] - cnt[j]) <= 1); 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /checker/IDCODE-12493.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "spoj.h" 3 | 4 | const int MAXN = 20002; 5 | const int MAXM = 2000002; 6 | 7 | using namespace std; 8 | 9 | vector a[MAXN]; 10 | vector Q[MAXM]; 11 | vector > E; 12 | int p[MAXN]; 13 | int ans[MAXN]; 14 | bool done[MAXN]; 15 | int n, m; 16 | 17 | bool isPermutation() { 18 | vector t (ans + 1, ans + 1 + n); 19 | sort(t.begin(), t.end()); 20 | for (int i = 0; i < n; ++i) if (t[i] != i + 1) return false; 21 | return true; 22 | } 23 | 24 | bool check() { 25 | for (int i = 1; i <= n; ++i) a[i].clear(); 26 | for (int i = 0; i < E.size(); ++i) { 27 | int u = E[i].first; 28 | int v = E[i].second; 29 | a[u].push_back(v); 30 | a[v].push_back(u); 31 | } 32 | for (int i = 1; i <= n; ++i) fscanf(spoj_t_out, "%d", &ans[i]);//output >> ans[i]; 33 | spoj_assert(isPermutation()); 34 | for (int i = 1; i <= n; ++i) p[ans[i]] = i; 35 | for (int i = 1; i <= n; ++i) Q[i].clear(); 36 | for (int i = 1; i <= n; ++i) done[i] = false; 37 | Q[p[1]].push_back(0); 38 | for (int it = 1; it <= n; ++it) { 39 | for (int i = 1; i <= n; ++i) if (!done[p[i]] && !Q[p[i]].empty()) { 40 | int u = p[i]; 41 | done[u] = true; 42 | for (int j = 0; j < a[u].size(); ++j) { 43 | int v = a[u][j]; 44 | if (!done[v]) { 45 | Q[v].push_back(i); 46 | } 47 | } 48 | break; 49 | } 50 | } 51 | for (int i = 2; i <= n; ++i) if (Q[p[i]] < Q[p[i - 1]]) return false; 52 | return true; 53 | } 54 | 55 | int main() { 56 | spoj_init(); 57 | fscanf(spoj_p_in, "%d %d", &n, &m); 58 | E.resize(m); 59 | for (int i = 0; i < m; ++i) 60 | fscanf(spoj_p_in, "%d %d", &E[i].first, &E[i].second); 61 | spoj_assert(check()); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /checker/VMSUDOKU-10815.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | string a[11]; 12 | char tmp[111]; 13 | 14 | bool row[11][11], col[11][11], cell[4][4][11]; 15 | 16 | void read_input() { 17 | for(int i = 0; i < 9; ++i) { 18 | spoj_assert(fscanf(spoj_t_out, "%s\n", &tmp[0]) == 1); 19 | spoj_assert(strlen(tmp) == 9); 20 | 21 | for(int j = 0; j < 9; ++j) { 22 | spoj_assert(tmp[j] >= '1' && tmp[j] <= '9'); 23 | } 24 | 25 | a[i] = string(tmp); 26 | 27 | cerr << a[i] << endl; 28 | } 29 | 30 | for(int i = 0; i < 9; ++i) 31 | for(int j = 0; j < 9; ++j) { 32 | int cur = a[i][j] - '0'; 33 | 34 | spoj_assert(row[i][cur] == false); 35 | spoj_assert(col[j][cur] == false); 36 | spoj_assert(cell[i/3][j/3][cur] == false); 37 | 38 | row[i][cur] = true; 39 | col[j][cur] = true; 40 | cell[i/3][j/3][cur] = true; 41 | } 42 | } 43 | 44 | int main() { 45 | spoj_init(); 46 | cerr << "Init" << endl; 47 | read_input(); 48 | cerr << "Done read input" << endl; 49 | 50 | int res = 0; 51 | for(int t = 1; t <= 9; ++t) { 52 | for(int i1 = 0; i1 < 9; ++i1) 53 | for(int j1 = 0; j1 < 9; ++j1) 54 | if (a[i1][j1] == t + '0') 55 | for(int i2 = 0; i2 < 9; ++i2) 56 | for(int j2 = 0; j2 < 9; ++j2) 57 | if (a[i2][j2] == t + '0') 58 | if (make_pair(i1, j1) < make_pair(i2, j2)) { 59 | res += t * abs(i1 - i2) * abs(j1 - j2); 60 | } 61 | } 62 | fprintf(spoj_score, "%d\n", max(0, res - 17000)); 63 | cerr << res << endl; 64 | } 65 | -------------------------------------------------------------------------------- /problem_set/hidden.txt: -------------------------------------------------------------------------------- 1 | Các bài hidden 2 | PPXOASO 3 | NKREP 4 | DTPOLY 5 | T7TEST2 6 | THT05 7 | MPTSNT 8 | SORTBIT 9 | CCBOND2 10 | LHPRET 11 | AMSF 12 | CCMALI 13 | C11LAMP 14 | FIRING 15 | COWROW 16 | GOODS 17 | MSOKCUOI 18 | TWOMST 19 | QTLOVE3 20 | CSUNLOCK 21 | C11TET 22 | CISLANDS 23 | DIEMTDT 24 | SKSTRI 25 | BCNN2809 26 | C11ROBOT 27 | MHIGHWAY 28 | CLANDSC 29 | KSWAPS 30 | AGIFT 31 | MROBOT 32 | WRONGDIR 33 | THPOINT 34 | PKA 35 | SUPERBIT 36 | NOEL 37 | LBREAL 38 | THT04 39 | C11RANK 40 | AMSH 41 | MTIMSO 42 | THSUM 43 | C11STR3 44 | CTIED 45 | MTGMAU 46 | MTRAMDEN 47 | AMSD 48 | LQDCANDY 49 | CTRACTOR 50 | NKAVA 51 | CBCSUB 52 | KMBUS 53 | CTPLUCKY 54 | MGENOME 55 | RELBOARD 56 | C11KING 57 | VOSMMM 58 | C3LINES 59 | T3NA1P 60 | BDX2109 61 | SECRETLE 62 | IVAN 63 | MTACOMP 64 | C11DIGIT 65 | CCDOMINO 66 | SCB2109 67 | CUNLOCK 68 | CCHERMAN 69 | TIME17 70 | CRUNLAPS 71 | THT03 72 | AVIRUT 73 | MNEMDA 74 | BIRTHDAY 75 | C11COINS 76 | MBITMAP 77 | NKEQ 78 | THUTHACH 79 | MBORECOL 80 | KBSTR 81 | NKITS 82 | DCTT 83 | MPM 84 | MGENEMAP 85 | M235 86 | DD8HUONG 87 | C11TREE 88 | TNT2222 89 | MTBSEQ 90 | NTKM 91 | KNGOC 92 | SS2809 93 | PACK 94 | MSCHOOL 95 | VMSQ 96 | CBSHELFG 97 | MDOTKICH 98 | PAIRINT 99 | VMKREIS 100 | EULER 101 | C11CITY 102 | FRACTION 103 | CTNMRECT 104 | C11PHONE 105 | THBAS 106 | THT02 107 | T7TEST 108 | PBIGNUM 109 | KLOTTE 110 | KCODE 111 | VOJTEST 112 | MHLP 113 | HBT3C 114 | MTONGLN 115 | C11R8 116 | DB2809 117 | C11MAT 118 | MDIEMTG 119 | CCSLIKAR 120 | HELICAL 121 | C11TREE2 122 | VIG 123 | CU2DEC15 124 | C11LEGO 125 | TPCROBOT 126 | TFILED 127 | MTRAU 128 | MCOSO 129 | THT01 130 | SXC2109 131 | C11FLAG 132 | FLOWPOT 133 | TOURS 134 | KDICT 135 | UCF 136 | THREE 137 | C11SUFIX 138 | CBSHELF 139 | MTAMSAO 140 | C11QUAKE 141 | LUCKSEQ 142 | CCBOND 143 | MNAM 144 | NDCSUM 145 | CTPDIRTY 146 | C11BC0 147 | CONCOW 148 | DTCONINT 149 | CCDEBUG 150 | -------------------------------------------------------------------------------- /checker/VMGAME-6974.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj_interactive.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #define FOR(i,a,b) for(int i=(a); i <= (b); ++i) 19 | #define FORD(i,a,b) for(int i=(a); i >= (b); --i) 20 | #define REP(i,a) FOR(i,0,(a)-1) 21 | #define PB push_back 22 | #define MP make_pair 23 | #define F first 24 | #define S second 25 | using namespace std; 26 | 27 | int n; 28 | int a[111][111], row[111], col[111]; 29 | bool used[111]; 30 | 31 | void readInput() { 32 | fprintf(spoj_p_info, "ReadInput\n"); 33 | fscanf(spoj_p_in, "%d", &n); 34 | FOR(i,1,n) FOR(j,1,n) { 35 | fscanf(spoj_p_in, "%d", &a[i][j]); 36 | row[i] += a[i][j]; 37 | col[j] += a[i][j]; 38 | } 39 | fprintf(spoj_p_info, "n = %d\n", n); 40 | } 41 | 42 | void writeInput() { 43 | fprintf(spoj_p_info, "WriteInput\n"); 44 | spoj_printf("%d\n", n); 45 | FOR(i,1,n) { 46 | FOR(j,1,n) spoj_printf("%d ", a[i][j]); 47 | spoj_printf("\n", 0); 48 | } 49 | fflush(spoj_for_tested); 50 | } 51 | 52 | int main() { 53 | spoj_init(); 54 | 55 | int score = 10; 56 | readInput(); 57 | writeInput(); 58 | 59 | FOR(turn,1,n) { 60 | int best = -1; 61 | FOR(i,1,n) if (!used[i]) { 62 | if (best == -1) best = i; 63 | if (row[i] + col[i] > row[best] + col[best]) best = i; 64 | } 65 | used[best] = true; 66 | if (turn <= 10) { 67 | fprintf(spoj_p_info, "best move = %d\n", best); 68 | } 69 | 70 | if (turn % 2 == 1) { 71 | int move; 72 | spoj_scanf("%d", &move); 73 | if (move != best) { 74 | score = 0; 75 | } 76 | } 77 | else { 78 | spoj_printf("%d\n", best); 79 | fflush(spoj_for_tested); 80 | } 81 | } 82 | 83 | fprintf(spoj_score, "%d\n", score); 84 | return SPOJ_RV_AC; 85 | } 86 | -------------------------------------------------------------------------------- /checker/MEXICO-13434.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | /* 8 | #include 9 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 10 | #define PIN "MEXICO.inp" 11 | #define POUT "MEXICO.ans" 12 | #define TOUT "MEXICO.out" 13 | 14 | void spoj_init() 15 | { 16 | spoj_p_in=fopen(PIN, "r"); 17 | spoj_p_out=fopen(POUT, "r"); 18 | spoj_t_out=fopen(TOUT, "r"); 19 | } 20 | 21 | #define spoj_assert assert 22 | */ 23 | int n, m; 24 | bool c[1001][1001]; 25 | int path[1001]; 26 | bool done[1001]; 27 | bool cross(int a1, int a2, int b1, int b2){ 28 | if(a1>a2) swap(a1, a2); 29 | if(b1>b2) swap(b1, b2); 30 | if((a1a2)||(b2 3 | using namespace std; 4 | 5 | /* 6 | Output: 7 | The minimum needed value 8 | 1..K next line, the ith line contain n/k integer denote vertex in group i 9 | */ 10 | 11 | const int MAX_N = 500 + 5; 12 | const int MAX_LEN = 10000; 13 | int n, m, k; 14 | int a[MAX_N][MAX_N]; 15 | int group[MAX_N]; 16 | 17 | void read_input() { 18 | fscanf(spoj_p_in, "%d%d%d", &n, &m, &k); 19 | while (m--) { 20 | int i, j; 21 | fscanf(spoj_p_in, "%d%d", &i, &j); 22 | a[i][j] = a[j][i] = 1; 23 | } 24 | } 25 | 26 | //return the output_score 27 | int read_output() { 28 | int output_score; 29 | //read output score 30 | spoj_assert(fscanf(spoj_t_out, "%d\n", &output_score) == 1); 31 | 32 | //read output group 33 | for(int i = 1; i <= k; ++i) { 34 | for (int j = 1; j <= n / k; j++) { 35 | int value; 36 | spoj_assert(fscanf(spoj_t_out, "%d", &value) == 1); 37 | spoj_assert(1 <= value && value <= n); 38 | spoj_assert(group[value] == 0); 39 | group[value] = i; 40 | } 41 | 42 | char dummy; 43 | while (true) { 44 | int status = fscanf(spoj_t_out, "%c", &dummy); 45 | if (status == -1) 46 | if (i == k) break; 47 | else dummy = 0; 48 | if (dummy != ' ') break; 49 | } 50 | spoj_assert(i == k || dummy == '\n'); 51 | } 52 | 53 | return output_score; 54 | } 55 | 56 | void check_output_score(int output_score) { 57 | for(int i = 1; i <= n; ++i) 58 | for(int j = i+1; j <= n; ++j) 59 | if (group[i] != group[j]) 60 | output_score -= a[i][j]; 61 | spoj_assert(output_score == 0); 62 | } 63 | 64 | int main() { 65 | spoj_init(); 66 | 67 | read_input(); 68 | int output_score = read_output(); 69 | check_output_score(output_score); 70 | 71 | int sol_score; fscanf(spoj_p_out, "%d", &sol_score); 72 | double score = 1. * (sol_score + 1.0) / (output_score+1); 73 | fprintf(spoj_score, "%.6f", score); 74 | } -------------------------------------------------------------------------------- /checker/VMCIRCLE-12314.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | using namespace std; 4 | 5 | const int MAX_N = 300 + 5; 6 | struct Edge{ 7 | int adj, color; 8 | Edge(int adj, int color) : adj(adj), color(color) {} 9 | }; 10 | 11 | int n; 12 | int nColor; 13 | vector a[MAX_N]; //Big circle is 0 14 | bool f[MAX_N][8]; 15 | 16 | 17 | void addEdge(int i, int j, int c){ 18 | a[i].push_back( Edge(j, c) ); 19 | a[j].push_back( Edge(i, c) ); 20 | } 21 | 22 | void input(){ 23 | fscanf(spoj_p_in,"%d",&n); 24 | } 25 | 26 | void loadOutput(){ 27 | //Solution color 28 | int solColor; 29 | fscanf(spoj_p_out,"%d",&solColor); 30 | 31 | //Ouput color 32 | spoj_assert( fscanf(spoj_t_out,"%d\n",&nColor)==1 ); 33 | spoj_assert( solColor == nColor ); 34 | 35 | for(int color, i=1; i<=n; ++i){ 36 | spoj_assert( fscanf(spoj_t_out,"%d",&color)==1 ); 37 | spoj_assert( 1<=color && color<=nColor ); 38 | color--; //Checker use 0-base color 39 | addEdge(0, i, color); 40 | } 41 | 42 | for(int color, i=1; i<=n; ++i){ 43 | spoj_assert( fscanf(spoj_t_out,"%d",&color)==1 ); 44 | spoj_assert( 1<=color && color<=nColor ); 45 | color--; //Checker use 0-base color 46 | 47 | int j = (i%n) + 1; 48 | addEdge(i, j, color); 49 | } 50 | } 51 | 52 | void check(int i){ 53 | memset(f, false, sizeof f); 54 | f[i][0] = true; 55 | 56 | queue< pair > q; 57 | q.push( make_pair(i,0) ); 58 | set visited; 59 | while (!q.empty()){ 60 | int i = q.front().first, state = q.front().second; 61 | q.pop(); 62 | visited.insert(i); 63 | 64 | for(int k=0; k<(int)a[i].size(); ++k){ 65 | int j = a[i][k].adj, color = a[i][k].color; 66 | if ( (state & (1< 4 | #include 5 | 6 | using namespace std; 7 | 8 | /* 9 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 10 | 11 | #define PIN "i.in" 12 | #define POUT "a.ans" 13 | #define TOUT "o.out" 14 | #define SCORE "p.txt" 15 | #define spoj_assert assert 16 | 17 | void spoj_init(){ 18 | spoj_p_in = fopen(PIN, "r"); 19 | spoj_p_out = fopen(POUT, "r"); 20 | spoj_t_out = fopen(TOUT, "r"); 21 | spoj_score = fopen(SCORE, "w"); 22 | } 23 | */ 24 | 25 | #define MAXN 30002 26 | 27 | typedef pair PID; 28 | 29 | int n, m, k, p, d, q = 0; 30 | double r[MAXN], pp, pd, point = 0.0, ans; 31 | vector t[MAXN]; 32 | vector tower; 33 | 34 | int main() { 35 | spoj_init(); 36 | 37 | fscanf(spoj_p_out, "%lf", &ans); 38 | 39 | fscanf(spoj_p_in, "%d%d%d%d%d", &n, &m, &k, &p, &d); 40 | 41 | pp = (double)p / 100; 42 | pd = (double)d / 100 + 1.0; 43 | 44 | for (int i = 1; i <= n; i++) fscanf(spoj_p_in, "%lf", &r[i]); 45 | 46 | for (int i = 1; i <= m; i++) { 47 | int h; 48 | fscanf(spoj_p_in, "%d", &h); 49 | q += h; 50 | while (h--) { 51 | int id; 52 | fscanf(spoj_p_in, "%d", &id); 53 | t[i].push_back(id); 54 | } 55 | } 56 | 57 | for (int kkk = 0; kkk < k; kkk++) { 58 | int l, i; 59 | double addpoint; 60 | spoj_assert(fscanf(spoj_t_out, "%d", &l)); 61 | spoj_assert(1 <= l && l <= m); 62 | spoj_assert(t[l].size()); 63 | 64 | i = t[l].back(); 65 | 66 | if (tower.empty() || ((PID)tower.back()).first != i) addpoint = r[i]; 67 | else addpoint = ((PID)tower.back()).second * pd; 68 | 69 | if (t[l].size() <= t[l - 1].size() || t[l].size() <= t[l + 1].size()) addpoint *= pp; 70 | 71 | t[l].pop_back(); 72 | tower.push_back(PID(i, addpoint)); 73 | point += addpoint; 74 | } 75 | 76 | double heso = (double)1 / 1000000 * k * m; 77 | fprintf(spoj_score, "%lf\n", point / ans * heso); 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /checker/VMREL6-10633.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | int a[111], c[111][111], n, ln, solution; 13 | 14 | void readSol() { 15 | fscanf(spoj_p_out, "%d", &solution); 16 | } 17 | 18 | void readSequence() { 19 | spoj_assert(fscanf(spoj_t_out, "%d", &ln) == 1); 20 | cerr << "OK: output = expected answer" << endl; 21 | spoj_assert(ln == solution); 22 | for(int i = 0; i < n; ++i) 23 | spoj_assert(fscanf(spoj_t_out, "%d", &a[i]) == 1); 24 | 25 | cerr << "OK: Can read all output" << endl; 26 | } 27 | 28 | void readBoard() { 29 | spoj_assert(fscanf(spoj_p_in, "%d", &n) == 1); 30 | for(int i = 0; i < n; ++i) 31 | for(int j = 0; j < n; ++j) 32 | spoj_assert(fscanf(spoj_p_in, "%d", &c[i][j]) == 1); 33 | } 34 | 35 | bool check() { 36 | spoj_assert(ln == *max_element(a, a+n)); 37 | 38 | cerr << "OK: max value = true max" << endl; 39 | 40 | for(int i = 0; i < n; ++i) 41 | for(int j = 0; j < n; ++j) { 42 | switch (c[i][j]) { 43 | case 0: 44 | spoj_assert(a[i] == a[j]); 45 | break; 46 | case 1: 47 | spoj_assert(a[i] < a[j]); 48 | break; 49 | case 2: 50 | spoj_assert(a[i] <= a[j]); 51 | break; 52 | case -1: 53 | spoj_assert(a[i] > a[j]); 54 | break; 55 | case -2: 56 | spoj_assert(a[i] >= a[j]); 57 | break; 58 | } 59 | } 60 | cerr << "OK: all conditions satisfy" << endl; 61 | return true; 62 | } 63 | 64 | int main() { 65 | spoj_init(); 66 | readSol(); 67 | readBoard(); 68 | readSequence(); 69 | if (check()) { 70 | fprintf(spoj_score, "100"); 71 | } else { 72 | fprintf(spoj_score, "0"); 73 | } 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /checker/VMLP-6709.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | 13 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 14 | #define PIN "Test\\input25.txt" 15 | #define POUT "Test\\output25.txt" 16 | #define TOUT "output.txt" 17 | #define SCORE "result.txt" 18 | 19 | void spoj_init() 20 | { 21 | spoj_p_in=fopen(PIN, "r"); 22 | spoj_p_out=fopen(POUT, "r"); 23 | spoj_t_out=fopen(TOUT, "r"); 24 | spoj_score=fopen(SCORE, "w"); 25 | } 26 | 27 | #define spoj_assert assert*/ 28 | 29 | #define MAXN 1010 30 | 31 | int n, m, solutionLen, expectedLen; 32 | vector out; 33 | bool e[MAXN][MAXN], exist[MAXN]; 34 | 35 | int main() { 36 | spoj_init(); 37 | 38 | spoj_assert(fscanf(spoj_p_in, "%d%d", &n, &m) == 2); 39 | for (int i = 0; i < m; i++) { 40 | int u, v; 41 | spoj_assert(fscanf(spoj_p_in, "%d%d", &u, &v) == 2); 42 | e[u][v] = true; 43 | e[v][u] = true; 44 | } 45 | spoj_assert(fscanf(spoj_t_out, "%d\n", &solutionLen)); 46 | char tmp[20001]; 47 | spoj_assert(fgets(tmp, 10000, spoj_t_out) != NULL); 48 | string s = tmp; 49 | stringstream ss(s); 50 | int cur; 51 | while (ss >> cur) { 52 | out.push_back(cur); 53 | spoj_assert(exist[cur] == false); 54 | exist[cur] = true; 55 | spoj_assert(cur >= 1 && cur <= n); 56 | } 57 | spoj_assert(solutionLen == out.size()); 58 | for (int i = 0; i + 1 < out.size(); i++) 59 | spoj_assert(e[out[i]][out[i + 1]] == true); 60 | 61 | fscanf(spoj_p_out, "%d", &expectedLen); 62 | 63 | double ratio = solutionLen * 1.0 / expectedLen; 64 | double point; 65 | if (ratio < 0.8) 66 | point = pow(100.0, ratio); 67 | else 68 | if (ratio <= 1) 69 | point = 40 + pow(60.0, (ratio - 0.8) / 0.2); 70 | else 71 | point = 100 + pow(100.0, ratio / 3.0); 72 | fprintf(spoj_score, "%0.6lf", point); 73 | //cout << point << endl; 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /checker/VOBOARD-7663.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | using namespace std; 18 | 19 | const int MAXN = 100; 20 | const double MAX_SCORE = 2.5; 21 | 22 | #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) 23 | 24 | #include 25 | 26 | /* 27 | #include 28 | FILE *spoj_p_in, *spoj_t_out, *spoj_score, *spoj_p_out; 29 | #define PIN "1.in" 30 | #define POUT "1.out" 31 | #define TOUT "output.txt" 32 | #define SCORE "result.txt" 33 | 34 | void spoj_init() { 35 | spoj_p_in = fopen(PIN, "r"); 36 | spoj_p_out = fopen(POUT, "r"); 37 | spoj_t_out = fopen(TOUT, "r"); 38 | spoj_score = fopen(SCORE, "w"); 39 | } 40 | #define spoj_assert assert 41 | */ 42 | 43 | int m, n, k, a[1011][1011], row[1011], col[1011]; 44 | 45 | 46 | void read_input() { 47 | spoj_assert(fscanf(spoj_p_in, "%d %d %d\n", &m, &n, &k) == 3); 48 | spoj_assert(m >= 1 && m <= 1000 && n >= 1 && n <= 1000); 49 | 50 | FOR(i,1,m) FOR(j,1,n) { 51 | spoj_assert(fscanf(spoj_p_in, "%d", &a[i][j]) == 1); 52 | spoj_assert(a[i][j] >= 0 && a[i][j] < k); 53 | } 54 | } 55 | 56 | void read_output() { 57 | long long best; 58 | fscanf(spoj_p_out, "%lld", &best); 59 | 60 | long long res; 61 | fscanf(spoj_t_out, "%lld", &res); 62 | 63 | spoj_assert(res == best); 64 | 65 | long long sum = 0; 66 | FOR(i,1,m) { 67 | fscanf(spoj_t_out, "%d", &row[i]); 68 | sum += row[i]; 69 | } 70 | FOR(j,1,n) { 71 | fscanf(spoj_t_out, "%d", &col[j]); 72 | sum += col[j]; 73 | } 74 | 75 | spoj_assert(sum == res); 76 | 77 | FOR(i,1,m) FOR(j,1,n) 78 | spoj_assert((a[i][j] + row[i] + col[j]) % k == 0); 79 | } 80 | 81 | int main() { 82 | spoj_init(); 83 | 84 | read_input(); 85 | read_output(); 86 | 87 | fprintf(spoj_score, "10"); 88 | return 0; 89 | } 90 | -------------------------------------------------------------------------------- /checker/TOUR2509-4965.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | #define max 30000 6 | typedef struct {int u, v;} Edge; 7 | int n, m, m1=0, best, result; 8 | int no[max]; 9 | Edge z[max]; 10 | 11 | bool cmp(Edge A, Edge B) 12 | { 13 | return (A.u < B.u) || (A.u==B.u && A.v z[k].v) swap(z[k].u, z[k].v); 23 | } 24 | sort(z+1, z+m+1, cmp); 25 | fscanf(spoj_p_out, "%d", &best); 26 | fscanf(spoj_t_out, "%d", &result); 27 | } 28 | 29 | int yes(int i, int j) 30 | {int L=1, R=m, h=0, k; 31 | while (L <= R) 32 | { k = (L+R)/2; 33 | if (i==z[k].u && j==z[k].v) { h = 1; 34 | break; 35 | } 36 | else 37 | if (iz[k].u || (i==z[k].u && j>z[k].v)) L = k+1; 40 | } 41 | return h; 42 | } 43 | 44 | int check(int i, int j) 45 | {int L=1, R=m, h=1, k; 46 | while (L <= R) 47 | { k = (L+R)/2; 48 | if (i==z[k].u && j==z[k].v) { if (no[k] == 1) h = 0; 49 | no[k] = 1; 50 | break; 51 | } 52 | else 53 | if (iz[k].u || (i==z[k].u && j>z[k].v)) L = k+1; 56 | } 57 | return h; 58 | } 59 | 60 | void process() 61 | {int run, k, i, j, e, h; 62 | for (k=1; k <= result; k++) 63 | { fscanf(spoj_t_out, "%d", &h); 64 | spoj_assert(h >= 2); 65 | fscanf(spoj_t_out, "%d", &e); 66 | for (run=1; run < h; run++) 67 | { fscanf(spoj_t_out, "%d", &j); 68 | i = e; 69 | e = j; 70 | if (i > j) swap(i, j); 71 | spoj_assert(yes(i, j) == 1); 72 | spoj_assert(check(i, j) == 1); 73 | } 74 | m1 += h-1; 75 | } 76 | spoj_assert(m1 == m); 77 | spoj_assert(result <= best); 78 | } 79 | 80 | int main() 81 | { 82 | spoj_init(); 83 | read_data(); 84 | process(); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /checker/VMCOINS-8638.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | /* 12 | FILE *spoj_p_in, *spoj_t_out, *spoj_score; 13 | #define PIN "input.txt" 14 | #define TOUT "output.txt" 15 | #define SCORE "result.txt" 16 | 17 | void spoj_init() 18 | { 19 | spoj_p_in=fopen(PIN, "r"); 20 | spoj_t_out=fopen(TOUT, "r"); 21 | spoj_score=fopen(SCORE, "w"); 22 | } 23 | 24 | #define spoj_assert assert 25 | */ 26 | 27 | const int MN = 100111; 28 | 29 | int n, k; 30 | pair a[MN], b[MN]; 31 | set< pair > cur; 32 | 33 | const int di[] = {-1,1,0,0}; 34 | const int dj[] = {0,0,-1,1}; 35 | 36 | int main() { 37 | spoj_init(); 38 | 39 | // Read input file 40 | fscanf(spoj_p_in, "%d", &n); 41 | 42 | // Read start configuration 43 | for(int i = 0; i < n; ++i) { 44 | fscanf(spoj_p_in, "%d%d", &a[i].first, &a[i].second); 45 | cur.insert(a[i]); 46 | } 47 | 48 | // Read target configuration 49 | for(int i = 0; i < n; ++i) 50 | fscanf(spoj_p_in, "%d%d", &b[i].first, &b[i].second); 51 | 52 | 53 | // Read output file & process 54 | spoj_assert(fscanf(spoj_t_out, "%d", &k) == 1); 55 | spoj_assert(k >= 0 && k <= 1000000); 56 | 57 | while (k--) { 58 | int x, y, u, v; 59 | spoj_assert(fscanf(spoj_t_out, "%d%d%d%d", &x, &y, &u, &v) == 4); 60 | 61 | // Position (x, y) must have a coin 62 | spoj_assert(cur.find(make_pair(x, y)) != cur.end()); 63 | 64 | // Position (u, v) must not have a coin 65 | spoj_assert(cur.find(make_pair(u, v)) == cur.end()); 66 | 67 | // Take coin from (x, y) 68 | cur.erase(make_pair(x, y)); 69 | int cnt = 0; 70 | 71 | for(int dir = 0; dir < 4; ++dir) { 72 | int uu = u + di[dir], vv = v + dj[dir]; 73 | if (cur.find(make_pair(uu, vv)) != cur.end()) ++cnt; 74 | } 75 | 76 | // New position must be adjacent to at least 2 coins 77 | spoj_assert(cnt >= 2); 78 | 79 | // Put coin to new position 80 | cur.insert(make_pair(u, v)); 81 | } 82 | 83 | // Check final configuration 84 | for(int i = 0; i < n; ++i) 85 | spoj_assert(cur.find(b[i]) != cur.end()); 86 | 87 | fprintf(spoj_score, "5"); 88 | 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /checker/VMDOM2-8621.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | using namespace std; 20 | 21 | /*FILE *spoj_p_in, *spoj_t_out, *spoj_score; 22 | #define PIN "in.in" 23 | #define TOUT "out.out" 24 | #define SCORE "result.out" 25 | 26 | void spoj_init() 27 | { 28 | spoj_p_in = fopen(PIN, "r"); 29 | spoj_t_out = fopen(TOUT, "r"); 30 | spoj_score = fopen(SCORE, "w"); 31 | } 32 | 33 | #define spoj_assert assert*/ 34 | 35 | int n, m, flag[111][111]; 36 | 37 | void readInput() 38 | { 39 | spoj_assert(fscanf(spoj_p_in, "%d%d\n", &m, &n) == 2); 40 | spoj_assert(n >= 10 && n <= 100 && n % 2 == 0); 41 | spoj_assert(m >= 10 && m <= 100 && m % 2 == 0); 42 | 43 | int x, y; 44 | for (int i = 0; i < 2; i++) 45 | { 46 | spoj_assert(fscanf(spoj_p_in, "%d%d\n", &x, &y) == 2); 47 | spoj_assert(x >= 1 && x <= m); 48 | spoj_assert(y >= 1 && y <= n); 49 | spoj_assert(flag[x][y] == 0); 50 | flag[x][y] = -1; 51 | } 52 | } 53 | 54 | int readOutput() 55 | { 56 | int sol; 57 | spoj_assert(fscanf(spoj_t_out, "%d", &sol) == 1); 58 | spoj_assert(sol >= 0 && sol <= 10); 59 | 60 | set < vector < pair > > s; 61 | 62 | for (int cur = 0; cur < sol; cur++) 63 | { 64 | int x, y, xx, yy; 65 | vector < pair > v; 66 | for (int i = 0; i < m * n / 2 - 1; i++) 67 | { 68 | spoj_assert(fscanf(spoj_t_out, "%d%d%d%d\n", &x, &y, &xx, &yy) == 4); 69 | spoj_assert(x >= 1 && x <= m); 70 | spoj_assert(xx >= 1 && xx <= m); 71 | spoj_assert(y >= 1 && y <= n); 72 | spoj_assert(yy >= 1 && yy <= n); 73 | spoj_assert(flag[x][y] == cur); 74 | spoj_assert(flag[xx][yy] == cur); 75 | spoj_assert(abs(x - xx) + abs(y - yy) == 1); 76 | flag[x][y] = flag[xx][yy] = cur + 1; 77 | 78 | x = x * n + y; xx = xx * n + yy; 79 | if (x > xx) swap(x, xx); 80 | v.push_back(make_pair(x, xx)); 81 | } 82 | 83 | sort(v.begin(), v.end()); 84 | spoj_assert(s.count(v) == 0); 85 | s.insert(v); 86 | } 87 | 88 | return sol; 89 | } 90 | 91 | int main() 92 | { 93 | spoj_init(); 94 | readInput(); 95 | fprintf(spoj_score, "%.1lf\n", 0.5 * readOutput()); 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /checker/VMST-10728.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | int n, m; 11 | bool c[1011][1011]; 12 | int lab[1011]; 13 | 14 | int getRoot(int u) { 15 | if (lab[u] < 0) return u; 16 | else return lab[u] = getRoot(lab[u]); 17 | } 18 | 19 | void merge(int u, int v) { 20 | u = getRoot(u); 21 | v = getRoot(v); 22 | 23 | lab[u] += lab[v]; 24 | lab[v] = u; 25 | } 26 | 27 | vector< pair > x[3]; 28 | 29 | void readInput() { 30 | spoj_assert(fscanf(spoj_p_in, "%d%d", &n, &m) == 2); 31 | spoj_assert(1 <= n && n <= 1000); 32 | spoj_assert(1 <= m && m <= 1500 && n <= m); 33 | while (m--) { 34 | int u, v; 35 | spoj_assert(fscanf(spoj_p_in, "%d%d", &u, &v) == 2); 36 | spoj_assert(1 <= u && u <= n); 37 | spoj_assert(1 <= v && v <= n); 38 | spoj_assert(u != v && !c[u][v]); 39 | 40 | c[u][v] = c[v][u] = true; 41 | } 42 | } 43 | 44 | void readOutput() { 45 | int k; 46 | // Check exists k and 0 < k <= 3 47 | spoj_assert(fscanf(spoj_t_out, "%d", &k) == 1); 48 | spoj_assert(k > 0 && k <= 3); 49 | 50 | for(int turn = 0; turn < k; ++turn) { 51 | memset(lab, -1, sizeof lab); 52 | for(int i = 0; i < n-1; ++i) { 53 | int u, v; 54 | // Check if edge is valid 55 | spoj_assert(fscanf(spoj_t_out, "%d%d", &u, &v)); 56 | spoj_assert(1 <= u && u <= n); 57 | spoj_assert(1 <= v && v <= n); 58 | spoj_assert(c[u][v]); 59 | 60 | x[turn].push_back(make_pair(min(u, v), max(u, v))); 61 | 62 | // Check if edge does not form cycle 63 | assert(getRoot(u) != getRoot(v)); 64 | merge(u, v); 65 | } 66 | 67 | sort(x[turn].begin(), x[turn].end()); 68 | } 69 | 70 | // Check whether no 2 spanning trees are the same 71 | for(int u = 0; u < k; ++u) 72 | for(int v = u+1; v < k; ++v) { 73 | bool equal = true; 74 | for(int i = 0; i < n-1; ++i) 75 | equal = equal && (x[u][i] == x[v][i]); 76 | spoj_assert(!equal); 77 | } 78 | 79 | if (k == 1) fprintf(spoj_score, "1\n"); 80 | else if (k == 2) fprintf(spoj_score, "2\n"); 81 | else fprintf(spoj_score, "5\n"); 82 | } 83 | 84 | int main() { 85 | spoj_init(); 86 | readInput(); 87 | readOutput(); 88 | } 89 | 90 | 91 | // Master judge: STRATEGY master judge -------------------------------------------------------------------------------- /helper/problem_set_helper.py: -------------------------------------------------------------------------------- 1 | import os 2 | class problem_set_helper: 3 | def __init__(self): 4 | self.dir_map = {} 5 | self.mapping_file_name() 6 | 7 | def mapping_file_name(self): 8 | self.dir_map = {} 9 | path = 'problem_set/' 10 | for x in os.listdir(path): 11 | if x.find('.') != -1: 12 | x = x[:x.find('.')] 13 | self.dir_map[x.lower()] = x 14 | else: 15 | self.dir_map[x.lower()] = x 16 | for y in os.listdir(path + x + '/'): 17 | y = y[:y.find('.')] 18 | self.dir_map[y.lower()] = y 19 | 20 | def format_name(self, x): 21 | tmp = x.lower() 22 | if tmp not in self.dir_map: 23 | return "NULL" 24 | return self.dir_map[tmp] 25 | 26 | def format_path(self, x): 27 | tmp = str(x.lower()) 28 | tmp.replace("//", "/") 29 | tmp = '/'.join(map(lambda x: self.format_name(x), tmp.split('/'))) 30 | return tmp 31 | 32 | def get_give_list(self, sets): 33 | 34 | problem_set = self.format_path(sets) 35 | 36 | path = "problem_set/" 37 | problems = [] 38 | folders = [] 39 | print(";" + problem_set + ";") 40 | if len(sets) >= 3 and sets[-3:].upper() == "ALL" != -1: 41 | if problem_set == "ALL": 42 | folders = [path + format_name("ALL") + ".txt"] 43 | else: 44 | path += problem_set[:problem_set.rfind('/') + 1] 45 | folders = [path + self.format_name(x[:x.find('.')]) + '.txt' for x in os.listdir(path)] 46 | else: 47 | folders = [path + problem_set + ".txt"] 48 | print(folders) 49 | files = [] 50 | for folder in folders: 51 | if folder.find('.') != -1: 52 | files.append(folder) 53 | else: 54 | files += os.listdir(folder) 55 | print(files) 56 | categories = "" 57 | for f in files: 58 | if (os.path.exists(f)): 59 | data = list(map(lambda x: x.strip('\n'), open(f, "r", encoding='utf-8').readlines())) 60 | categories += data[0] + ", " 61 | problems += data[1:] 62 | else: 63 | problems += [sets] 64 | if len(categories) >= 2: 65 | categories = categories[0:-2] 66 | 67 | # problems = list(set(problems)) # erase duplicate problems 68 | print(problems) 69 | return problems, categories -------------------------------------------------------------------------------- /checker/BPAINT-4915.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 12 | #define PIN "in.txt" 13 | #define POUT "ans.txt" 14 | #define TOUT "out.txt" 15 | #define SCORE "score.txt" 16 | 17 | void spoj_init() 18 | { 19 | spoj_p_in=fopen(PIN, "r"); 20 | spoj_p_out=fopen(POUT, "r"); 21 | spoj_t_out=fopen(TOUT, "r"); 22 | spoj_score=fopen(SCORE, "w"); 23 | } 24 | 25 | #define spoj_assert assert*/ 26 | 27 | #define MAX 60 28 | 29 | int a[MAX][MAX], n, m, k, cnt; 30 | bool visit[MAX][MAX]; 31 | 32 | const int di[] = {-1,0,1,0}; 33 | const int dj[] = {0,1,0,-1}; 34 | 35 | void dfs(int i, int j) { 36 | visit[i][j]=true; 37 | ++cnt; 38 | for (int d=0; d<4; ++d) { 39 | int i2 = i + di[d]; 40 | int j2 = j + dj[d]; 41 | if (1<=i2 && i2<=n && 1<=j2 && j2<=m && a[i2][j2]==a[i][j] && !visit[i2][j2]) { 42 | dfs(i2,j2); 43 | } 44 | } 45 | } 46 | 47 | int main() { 48 | spoj_init(); 49 | fscanf(spoj_p_in, "%d%d%d",&n,&m,&k); 50 | for (int i=1; i<=n; ++i) for (int j=1; j<=m; ++j) fscanf(spoj_p_in,"%d", &a[i][j]); 51 | 52 | double hs2 = 1; 53 | if(m == 5 || m == 20 || m == 30) hs2 = 2; 54 | if(m == 40) hs2 = 1/1.5; 55 | if(m == 50) hs2 = 1/12.0; 56 | 57 | memset(visit,0,sizeof(visit)); 58 | int heso = 0; 59 | for(int i=1;i<=n;++i) for(int j=1;j<=m;++j)if(!visit[i][j]){ 60 | cnt = 0; 61 | dfs(i,j); 62 | heso += cnt * cnt; 63 | } 64 | memset(visit,0,sizeof(visit)); 65 | 66 | while (k--) { 67 | int i, j, t; 68 | spoj_assert(fscanf(spoj_t_out, "%d%d%d", &i, &j, &t) == 3); 69 | spoj_assert(1<=i && i<=n); 70 | spoj_assert(1<=j && j<=m); 71 | spoj_assert(1<=t && t<=3000); 72 | memset(visit,0,sizeof(visit)); 73 | dfs(i,j); 74 | for (int i=1; i<=n; ++i) for (int j=1; j<=m; ++j) if (visit[i][j]) a[i][j]=t; 75 | } 76 | /* for (int i=1; i<=n; ++i) { 77 | for (int j=1; j<=m; ++j) cout << a[i][j] << " "; 78 | cout << endl; 79 | }*/ 80 | double scr = 0; 81 | memset(visit,0,sizeof(visit)); 82 | for (int i=1; i<=n; ++i) for (int j=1; j<=m; ++j) if (!visit[i][j]) { 83 | cnt = 0; 84 | dfs(i,j); 85 | scr += cnt*cnt; 86 | } 87 | scr/=heso; 88 | scr = scr * hs2; 89 | fprintf(spoj_score, "%lf", scr); 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /checker/UPBOUND-11078.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | //input: in.txt 9 | //output: out.txt 10 | //answer: ans.txt 11 | 12 | 13 | //FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 14 | //#define PIN "in.txt" 15 | //#define POUT "ans.txt" 16 | //#define TOUT "out.txt" 17 | #define foru(i, l, r) for(i = l; i <= r;i ++) 18 | 19 | const int maxN = 2*int(1e6)+111; 20 | 21 | struct edge { 22 | int u, v; 23 | edge (int u, int v) : u(u), v(v) {} 24 | edge() {} 25 | }; 26 | 27 | bool operator < (edge i, edge j) { 28 | if (i.u != j.u) return i.u < j.u; 29 | return i.v < j.v; 30 | } 31 | 32 | bool operator == (edge i, edge j) { 33 | if (i.u != j.u) return false; 34 | return i.v == j.v; 35 | } 36 | 37 | edge inp[maxN], tmp_edge; 38 | int path[maxN]; 39 | bool dau[maxN], vip[maxN]; 40 | int N, M, S, K, i, tmp, D, dem = 0, x; 41 | 42 | //void spoj_init() 43 | //{ 44 | // spoj_p_in=fopen(PIN, "r"); 45 | // spoj_p_out=fopen(POUT, "r"); 46 | // spoj_t_out=fopen(TOUT, "r"); 47 | //} 48 | // 49 | //void spoj_assert(bool b) { 50 | // if (!b) exit(1); 51 | //} 52 | 53 | int main(){ 54 | spoj_init(); 55 | 56 | char ans[100], ret[100]; 57 | fscanf(spoj_p_out, "%s", ans); 58 | fscanf(spoj_t_out, "%s", ret); 59 | spoj_assert(strcmp(ans, ret)==0); 60 | if (strcmp(ans, "TAK")==0) { 61 | //fscanf(spoj_t_out, "\n"); 62 | int s, k, n; 63 | fscanf(spoj_p_in, "%d %d %d %d", &N, &M, &S, &K); 64 | foru(i, 1, M) fscanf(spoj_p_in, "%d %d", &inp[i].u, &inp[i].v); 65 | 66 | tmp = M; 67 | foru(i, 1, M) 68 | inp[++tmp] = edge(inp[i].v, inp[i].u); 69 | M = tmp; 70 | sort(inp+1, inp+M+1); 71 | 72 | fscanf(spoj_t_out, "%d", &D); 73 | foru(i, 1, D) fscanf(spoj_t_out, "%d", &path[i]); 74 | 75 | foru(i, 1, K) fscanf(spoj_p_in, "%d", &x), vip[x] = true; 76 | 77 | spoj_assert(path[1] == S); 78 | spoj_assert(path[D] == S); 79 | 80 | foru(i, 2, D) { 81 | tmp_edge = edge(path[i-1], path[i]); 82 | x = lower_bound(inp+1, inp+M+1, tmp_edge)-inp; 83 | spoj_assert(x <= M); 84 | spoj_assert(tmp_edge == inp[x]); 85 | spoj_assert(!dau[x]); 86 | dau[x] = true; 87 | vip[path[i]] = false; 88 | } 89 | 90 | foru(i, 1, N) spoj_assert(!vip[i]); 91 | } 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /checker/VOSTRAVL-11079.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | //input: in.txt 9 | //output: out.txt 10 | //answer: ans.txt 11 | 12 | 13 | //FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 14 | //#define PIN "in.txt" 15 | //#define POUT "ans.txt" 16 | //#define TOUT "out.txt" 17 | #define foru(i, l, r) for(i = l; i <= r;i ++) 18 | 19 | const int maxN = 2*int(1e6)+111; 20 | 21 | struct edge { 22 | int u, v; 23 | edge (int u, int v) : u(u), v(v) {} 24 | edge() {} 25 | }; 26 | 27 | bool operator < (edge i, edge j) { 28 | if (i.u != j.u) return i.u < j.u; 29 | return i.v < j.v; 30 | } 31 | 32 | bool operator == (edge i, edge j) { 33 | if (i.u != j.u) return false; 34 | return i.v == j.v; 35 | } 36 | 37 | edge inp[maxN], tmp_edge; 38 | int path[maxN]; 39 | bool dau[maxN], vip[maxN]; 40 | int N, M, S, K, i, tmp, D, dem = 0, x; 41 | 42 | //void spoj_init() 43 | //{ 44 | // spoj_p_in=fopen(PIN, "r"); 45 | // spoj_p_out=fopen(POUT, "r"); 46 | // spoj_t_out=fopen(TOUT, "r"); 47 | //} 48 | // 49 | //void spoj_assert(bool b) { 50 | // if (!b) exit(1); 51 | //} 52 | 53 | int main(){ 54 | spoj_init(); 55 | 56 | char ans[100], ret[100]; 57 | fscanf(spoj_p_out, "%s", ans); 58 | fscanf(spoj_t_out, "%s", ret); 59 | spoj_assert(strcmp(ans, ret)==0); 60 | if (strcmp(ans, "TAK")==0) { 61 | //fscanf(spoj_t_out, "\n"); 62 | int s, k, n; 63 | fscanf(spoj_p_in, "%d %d %d %d", &N, &M, &S, &K); 64 | foru(i, 1, M) fscanf(spoj_p_in, "%d %d", &inp[i].u, &inp[i].v); 65 | 66 | tmp = M; 67 | foru(i, 1, M) 68 | inp[++tmp] = edge(inp[i].v, inp[i].u); 69 | M = tmp; 70 | sort(inp+1, inp+M+1); 71 | 72 | fscanf(spoj_t_out, "%d", &D); 73 | foru(i, 1, D) fscanf(spoj_t_out, "%d", &path[i]); 74 | 75 | foru(i, 1, K) fscanf(spoj_p_in, "%d", &x), vip[x] = true; 76 | 77 | spoj_assert(path[1] == S); 78 | spoj_assert(path[D] == S); 79 | 80 | foru(i, 2, D) { 81 | tmp_edge = edge(path[i-1], path[i]); 82 | x = lower_bound(inp+1, inp+M+1, tmp_edge)-inp; 83 | spoj_assert(x <= M); 84 | spoj_assert(tmp_edge == inp[x]); 85 | spoj_assert(!dau[x]); 86 | dau[x] = true; 87 | vip[path[i]] = false; 88 | } 89 | 90 | foru(i, 1, N) spoj_assert(!vip[i]); 91 | } 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /checker/RELBOARD-4049.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* 5 | FILE *spoj_p_in, *spoj_t_out, *spoj_score; 6 | 7 | void spoj_init() { 8 | spoj_p_in = fopen("r.in", "r"); 9 | spoj_t_out = fopen("r.out", "r"); 10 | spoj_score = fopen("score.out", "w"); 11 | } 12 | 13 | void spoj_assert(bool b) { 14 | if (b == true) fprintf(spoj_score, "Accepted.\n"); 15 | else fprintf(spoj_score, "Wrong Answer.\n"); 16 | } 17 | 18 | */ 19 | 20 | #define maxn 1000 21 | 22 | int n, a[maxn + 5][maxn + 5], maxT, T[maxn + 5]; 23 | bool correct; 24 | 25 | int main() { 26 | spoj_init(); 27 | 28 | fscanf(spoj_p_in, "%d", &n); 29 | for (int i = 1; i <= n; ++ i) 30 | for (int j = 1; j <= n; ++ j) fscanf(spoj_p_in, "%d", &a[i][j]); 31 | 32 | for (int i = 1; i <= n; ++ i) T[i] = -1; 33 | fscanf(spoj_t_out, "%d", &maxT); 34 | for (int i = 1; i <= n; ++ i) fscanf(spoj_t_out, "%d", &T[i]); 35 | 36 | correct = true; 37 | for (int i = 1; i <= n; ++ i) 38 | if (T[i] <= 0) correct = false; 39 | 40 | int mT = 0; 41 | for (int i = 1; i <= n; ++ i) 42 | if (mT < T[i]) mT = T[i]; 43 | if (mT != maxT) correct = false; 44 | 45 | for (int i = 1; i <= n; ++ i) 46 | for (int j = 1; j <= n; ++ j) { 47 | switch (a[i][j]) { 48 | case 0: 49 | if (T[i] != T[j]) { 50 | correct = false; 51 | } 52 | break; 53 | case 1: 54 | if (T[i] >= T[j]) { 55 | correct = false; 56 | } 57 | break; 58 | case -1: 59 | if (T[i] <= T[j]) { 60 | correct = false; 61 | } 62 | break; 63 | case 2: 64 | if (T[i] > T[j]) { 65 | correct = false; 66 | } 67 | break; 68 | case -2: 69 | if (T[i] < T[j]) { 70 | correct = false; 71 | } 72 | break; 73 | case 3: 74 | if (T[i] == T[j]) { 75 | correct = false; 76 | } 77 | break; 78 | } 79 | } 80 | 81 | spoj_assert(correct); 82 | fprintf(spoj_score, "%d\n", maxT); 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /checker/VMCUT-12148.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | #include 3 | using namespace std; 4 | 5 | typedef pair pii; 6 | 7 | const int MN = 100111; 8 | struct DSU { 9 | int lab[MN]; 10 | void init(int n) { 11 | for(int i = 0; i <= n; ++i) 12 | lab[i] = -1; 13 | } 14 | 15 | int getRoot(int u) { 16 | if (lab[u] < 0) return u; 17 | return lab[u] = getRoot(lab[u]); 18 | } 19 | 20 | bool merge(int u, int v) { 21 | u = getRoot(u); v = getRoot(v); 22 | if (u == v) return false; 23 | if (lab[u] > lab[v]) swap(u, v); 24 | lab[u] += lab[v]; 25 | lab[v] = u; 26 | return true; 27 | } 28 | }; 29 | 30 | int main() { 31 | spoj_init(); 32 | 33 | // input the graph 34 | int n, m; 35 | vector edges; 36 | fscanf(spoj_p_in, "%d%d", &n, &m); 37 | for (int i = 0; i < m; i++) { 38 | pii edge; 39 | fscanf(spoj_p_in, "%d%d", &edge.first, &edge.second); 40 | edges.push_back(edge); 41 | } 42 | 43 | // check D(H) 44 | int dh, t_dh; 45 | fscanf(spoj_p_out, "%d", &dh); 46 | spoj_assert(fscanf(spoj_t_out, "%d", &t_dh)); 47 | 48 | // check the set H 49 | int h_size; 50 | set h; 51 | spoj_assert(fscanf(spoj_t_out, "%d", &h_size)); 52 | for (int i = 0; i < h_size; i++) { 53 | int vertex; 54 | spoj_assert(fscanf(spoj_t_out, "%d", &vertex)); 55 | 56 | // verify whether the user vertex is correct 57 | spoj_assert(1 <= vertex && vertex <= n); 58 | 59 | // no vertex appears twice in the list 60 | spoj_assert(h.find(vertex) == h.end()); 61 | 62 | h.insert(vertex); 63 | } 64 | 65 | if (h.size() > 0) { 66 | // check H is connected 67 | DSU dsu; 68 | dsu.init(n); 69 | for (int i = 0; i < m; ++i) { 70 | int u = edges[i].first, v = edges[i].second; 71 | if (h.count(u) && h.count(v)) 72 | dsu.merge(u, v); 73 | } 74 | int u = *h.begin(); 75 | for (__typeof(h.begin()) it = h.begin(); it != h.end(); ++it) { 76 | spoj_assert(dsu.getRoot(*it) == dsu.getRoot(u)); 77 | } 78 | } 79 | 80 | int counter = t_dh; 81 | for (int i = 0; i < m; i++) { 82 | if ((h.find(edges[i].first) != h.end() && h.find(edges[i].second) == h.end()) || 83 | (h.find(edges[i].second) != h.end() && h.find(edges[i].first) == h.end())) 84 | counter--; 85 | } 86 | // verify whether the set H corresponds to D(H) 87 | spoj_assert(counter == 0); 88 | 89 | fprintf(spoj_score, "%.2lf", double(t_dh) / dh); 90 | 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /checker/VMAOCE-8447.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | using namespace std; 20 | 21 | int n, d[100100], region[100100], subtree[100100], cnt[10]; 22 | vector a[100100]; 23 | 24 | int get(int x) 25 | { 26 | return x == d[x] ? x : d[x] = get(d[x]); 27 | } 28 | 29 | void readInput() 30 | { 31 | spoj_assert(fscanf(spoj_p_in, "%d\n", &n) == 1); 32 | spoj_assert(n >= 1 && n <= 100000); 33 | 34 | for (int i = 1; i <= n; i++) d[i] = i; 35 | 36 | int x, y; 37 | for (int i = 1; i < n; i++) 38 | { 39 | spoj_assert(fscanf(spoj_p_in, "%d %d\n", &x, &y) == 2); 40 | spoj_assert(x >= 1 && x <= n); 41 | spoj_assert(y >= 1 && y <= n); 42 | spoj_assert(get(x) != get(y)); 43 | d[get(x)] = get(y); 44 | a[x].push_back(y); 45 | a[y].push_back(x); 46 | } 47 | } 48 | 49 | void dfs(int x, int par, int curRegion) 50 | { 51 | spoj_assert(region[x] == curRegion); 52 | subtree[x] = 1; 53 | for (int i = 0; i < int(a[x].size()); i++) 54 | { 55 | int y = a[x][i]; 56 | if (y != par) 57 | { 58 | dfs(y, x, curRegion); 59 | subtree[x] += subtree[y]; 60 | } 61 | } 62 | } 63 | 64 | void readOutput() 65 | { 66 | int hasAnswer; 67 | spoj_assert(fscanf(spoj_p_out, "%d", &hasAnswer) == 1); 68 | 69 | int sol; 70 | spoj_assert(fscanf(spoj_t_out, "%d", &sol) == 1); 71 | 72 | if (hasAnswer == -1) spoj_assert(sol == -1); 73 | else spoj_assert(sol != -1); 74 | 75 | if (hasAnswer == -1) return; 76 | 77 | region[1] = sol; 78 | 79 | for (int i = 2; i <= n; i++) 80 | spoj_assert(fscanf(spoj_t_out, "%d", region + i) == 1); 81 | 82 | int root = 0; 83 | for (int i = 1; i <= n; i++) 84 | { 85 | spoj_assert(region[i] >= 0 && region[i] <= 3); 86 | if (region[i] == 0) 87 | { 88 | spoj_assert(root == 0); 89 | root = i; 90 | } 91 | } 92 | 93 | // check each subtree must be in 1 region 94 | for (int i = 0; i < int(a[root].size()); i++) 95 | { 96 | int x = a[root][i]; 97 | dfs(x, root, region[x]); 98 | cnt[region[x]] += subtree[x]; 99 | } 100 | 101 | // check number of vertices in each region 102 | for (int i = 1; i <= 3; i++) 103 | spoj_assert(cnt[i] > 0 && cnt[i] * 2 <= n); 104 | } 105 | 106 | int main() 107 | { 108 | spoj_init(); 109 | readInput(); 110 | readOutput(); 111 | fprintf(spoj_score, "5"); 112 | return 0; 113 | } 114 | -------------------------------------------------------------------------------- /checker/VODIVIDE-11445.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "spoj.h" 19 | using namespace std; 20 | /*FILE *spoj_p_in, *spoj_t_out, *spoj_score; 21 | #define PIN "in.in" 22 | #define TOUT "out.out" 23 | #define SCORE "result.out" 24 | 25 | void spoj_init() 26 | { 27 | spoj_p_in = fopen(PIN, "r"); 28 | spoj_t_out = fopen(TOUT, "r"); 29 | spoj_score = fopen(SCORE, "w"); 30 | } 31 | 32 | #define spoj_assert assert*/ 33 | struct bg{ 34 | int a, b, c;} c[5005]; 35 | 36 | bool cmp(const bg&x, const bg&y) 37 | { 38 | if (x.a>y.a) return true; 39 | return false; 40 | } 41 | 42 | int f[5005][3000], n, vt[5005]; 43 | bool kt[5005]; 44 | 45 | void ReadInput() 46 | { 47 | spoj_assert(fscanf(spoj_p_in, "%d\n", &n) == 1); 48 | spoj_assert(n>=1 && n<=5000); 49 | for(int i=1; i<=n; i++) 50 | { 51 | spoj_assert(fscanf(spoj_p_in, "%d\n", &c[i].a) == 1); 52 | spoj_assert(c[i].a>=1 && c[i].a<=400000); 53 | } 54 | for(int i=1; i<=n; i++) 55 | { 56 | spoj_assert(fscanf(spoj_p_in, "%d\n", &c[i].b) == 1); 57 | spoj_assert(c[i].b>=1 && c[i].b<=400000); 58 | } 59 | for(int i=1; i<=n; i++) c[i].c = i; 60 | sort(1+c, 1+n+c, cmp); 61 | f[1][1] = 0; 62 | for(int i=2; i<=n; i++) 63 | { 64 | for(int j=0; j<=i/2; j++) 65 | { 66 | f[i][j] = f[i-1][j]; 67 | if (j>0) f[i][j] = max(f[i][j], f[i-1][j-1] + c[i].b); 68 | } 69 | } 70 | for(int i=1; i<=n; i++) vt[c[i].c] = i; 71 | } 72 | 73 | int ReadOutput() 74 | { 75 | int res; 76 | spoj_assert(fscanf(spoj_t_out, "%d", &res) == 1); 77 | spoj_assert(res == f[n][n/2]); 78 | int sum = 0; 79 | memset(kt, true, sizeof(kt)); 80 | for(int i=1; i<=n/2; i++) 81 | { 82 | int x, y; 83 | spoj_assert(fscanf(spoj_t_out, "%d%d", &x, &y) == 2); 84 | spoj_assert(x>=1 && x<=n); 85 | spoj_assert(y>=1 && y<=n); 86 | spoj_assert(kt[x]); kt[x] = false; 87 | spoj_assert(kt[y]); kt[y] = false; 88 | x = vt[x]; y = vt[y]; 89 | if (c[x].a^': 50 | S.append(c + sz) 51 | else: 52 | S.append(sz + c) 53 | else: 54 | S.append(c) 55 | lastc = c 56 | return ''.join(S) 57 | 58 | def format_header(self, data): 59 | return self._pad(data, self._header).format(*data) 60 | 61 | def format_line(self, c): 62 | data = ['']*self.ncols 63 | return self._pad(data, self._header).replace(':', ':'+c).format(*data) 64 | 65 | def format_body(self, data): 66 | return self._pad(data, self._body).format(*data) 67 | 68 | def set_colwidths(self, sizes): 69 | self.sizes = sizes 70 | 71 | class Table: 72 | def __init__(self, style): 73 | self.style = style 74 | self.rows = [] 75 | 76 | def append(self, row): 77 | self.rows.append(row) 78 | return self 79 | __add__ = append 80 | 81 | def __repr__(self): 82 | sizes = [row.sizes() for row in self.rows if isinstance(row, Content)] 83 | max_colsize = [max(s[i] for s in sizes) for i in range(self.style.ncols)] 84 | self.style.set_colwidths(max_colsize) 85 | return '\n'.join(row.layout(self.style) for row in self.rows) 86 | __str__ = __repr__ 87 | -------------------------------------------------------------------------------- /checker/CINEMA-11444.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "spoj.h" 19 | using namespace std; 20 | /*FILE *spoj_p_in, *spoj_t_out, *spoj_score; 21 | #define PIN "in.in" 22 | #define TOUT "out.out" 23 | #define SCORE "result.out" 24 | 25 | void spoj_init() 26 | { 27 | spoj_p_in = fopen(PIN, "r"); 28 | spoj_t_out = fopen(TOUT, "r"); 29 | spoj_score = fopen(SCORE, "w"); 30 | } 31 | 32 | #define spoj_assert assert*/ 33 | 34 | int dx[4] = {0, -1, 0, 1}; 35 | int dy[4] = {-1, 0, 1, 0}; 36 | bool inq[1010][1010], kt[10001000]; 37 | int a[10001000], b[1010][1010]; 38 | int m, n, k; 39 | 40 | int loang(int u, int v, int t) 41 | { 42 | int res = 1; 43 | inq[u][v] = false; 44 | for(int i=0; i<4; i++) 45 | { 46 | int x = u + dx[i], y = v + dy[i]; 47 | if (x<1||x>m||y<1||y>n) continue; 48 | if (!inq[x][y]) continue; 49 | if (b[x][y] != t) continue; 50 | inq[x][y] = false; 51 | res += loang(x, y, t); 52 | } 53 | return res; 54 | } 55 | 56 | void ReadInput() 57 | { 58 | spoj_assert(fscanf(spoj_p_in, "%d%d\n", &m, &n) == 2); 59 | spoj_assert(n>=1 && n<=1000); 60 | spoj_assert(m>=1 && m<=1000); 61 | spoj_assert(fscanf(spoj_p_in, "%d\n", &k) == 1); 62 | int sum = 0; 63 | for(int i=1; i<=k; i++) 64 | { 65 | spoj_assert(fscanf(spoj_p_in, "%d", &a[i]) == 1); 66 | sum += a[i]; 67 | } 68 | spoj_assert(sum <= m*n); 69 | } 70 | 71 | int readOutput() 72 | { 73 | for(int i=1; i<=m; i++) 74 | for(int j=1; j<=n; j++) 75 | { 76 | int x; 77 | spoj_assert(fscanf(spoj_t_out, "%d", &x) == 1); 78 | b[i][j] = x; 79 | spoj_assert(x <= k); 80 | } 81 | memset(kt, true, sizeof(kt)); 82 | memset(inq, true, sizeof(inq)); 83 | for(int i=1; i<=m; i++) 84 | for(int j=1; j<=n; j++) 85 | if (b[i][j]>0) 86 | { 87 | int x = b[i][j]; 88 | if (!kt[x] && inq[i][j]) spoj_assert(1 == 0); 89 | if (!inq[i][j]) continue; 90 | int y = loang(i, j, x); 91 | spoj_assert(y == a[x]); 92 | kt[x] = false; 93 | } 94 | for(int i=1; i<=k; i++) spoj_assert(a[i]==0 || !kt[i]); 95 | return 4; 96 | } 97 | 98 | int main() 99 | { 100 | spoj_init(); 101 | ReadInput(); 102 | fprintf(spoj_score, "%d\n", readOutput()); 103 | return 0; 104 | } 105 | -------------------------------------------------------------------------------- /checker/BALLGMVN-9958.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | /* 3 | spoj_p_in: input 4 | spoj_p_out: output 5 | spoj_t_out: user's output 6 | spoj_score: score 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #define FOR(a,b,c) for (int a=b,_c=c;a<=_c;a++) 26 | #define FORD(a,b,c) for (int a=b;a>=c;a--) 27 | #define REP(i,a) for(int i=0,_a=(a); i<_a; ++i) 28 | #define REPD(i,a) for(int i=(a)-1; i>=0; --i) 29 | #define pb push_back 30 | #define mp make_pair 31 | #define fi first 32 | #define se second 33 | #define sz(a) int(a.size()) 34 | #define reset(a,b) memset(a,b,sizeof(a)) 35 | 36 | using namespace std; 37 | /* 38 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 39 | #define PIN "19.in" 40 | #define POUT "19.out" 41 | #define TOUT "a.out" 42 | #define SCORE "score.txt" 43 | 44 | void spoj_init() 45 | { 46 | spoj_p_in=fopen(PIN,"r"); 47 | spoj_p_out=fopen(POUT, "r"); 48 | spoj_t_out=fopen(TOUT, "r"); 49 | spoj_score=fopen(SCORE, "w"); 50 | } 51 | 52 | void spoj_assert(bool t) 53 | { 54 | assert(t); 55 | } 56 | */ 57 | 58 | int n, res; 59 | pair p[2222]; 60 | 61 | bool check(pair a, pair b, pair c) { 62 | b.first -= a.first; 63 | b.second -= a.second; 64 | 65 | c.first -= a.first; 66 | c.second -= a.second; 67 | 68 | long long res = (long long) b.first * c.second - (long long) b.second * c.first; 69 | 70 | return res == 0; 71 | } 72 | 73 | int main(){ 74 | spoj_init(); 75 | 76 | //judger input 77 | fscanf(spoj_p_in, "%d", &n); 78 | for (int i= 1; i <= 2 * n; i++) 79 | fscanf(spoj_p_in, "%d%d", &p[i].first, &p[i].second); 80 | 81 | //judger output 82 | fscanf(spoj_p_out, "%d", &res); 83 | 84 | //user output 85 | int userRes; 86 | spoj_assert (fscanf(spoj_t_out, "%d", &userRes) == 1); 87 | 88 | if (userRes == -1) { 89 | assert(res == -1); 90 | fprintf(spoj_score, "1"); 91 | return 0; 92 | } 93 | 94 | assert(res != -1); 95 | int a = userRes, b, c; 96 | spoj_assert (fscanf(spoj_t_out, "%d", &b) == 1); 97 | spoj_assert (fscanf(spoj_t_out, "%d", &c) == 1); 98 | 99 | spoj_assert(1 <= a && a <= 2 * n); 100 | spoj_assert(1 <= b && b <= 2 * n); 101 | spoj_assert(1 <= c && c <= 2 * n); 102 | spoj_assert(a != b && b != c && c != a); 103 | spoj_assert ((a > n) != (b > n) || (b > n) != (c > n)); 104 | 105 | spoj_assert(check(p[a], p[b], p[c])); 106 | //All ok! 107 | fprintf(spoj_score, "1"); 108 | return 0; 109 | } 110 | -------------------------------------------------------------------------------- /checker/VMXGAME-6858.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define FOR(i,a,b) for(int i = (a), _b=(b); i <= _b; ++i) 18 | #define MP make_pair 19 | #define PB push_back 20 | 21 | using namespace std; 22 | 23 | //#define RR 24 | 25 | #ifdef RR 26 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 27 | #define PIN "0.in" 28 | #define TOUT "output.txt" 29 | #define SCORE "result.txt" 30 | 31 | void spoj_init() 32 | { 33 | spoj_p_in=fopen(PIN, "r"); 34 | //spoj_p_out=fopen(POUT, "r"); 35 | spoj_t_out=fopen(TOUT, "r"); 36 | spoj_score=fopen(SCORE, "w"); 37 | } 38 | 39 | #define spoj_assert assert 40 | #endif 41 | 42 | int n; 43 | 44 | int min_left(int n) { 45 | if (n % 3 == 0) return 2; 46 | else return 1; 47 | } 48 | 49 | set< pair > s; 50 | 51 | int main() { 52 | spoj_init(); 53 | 54 | // Read number of test 55 | int ntest; 56 | fscanf(spoj_p_in, "%d", &ntest); 57 | 58 | // Initialize total score 59 | double score = 0.0; 60 | 61 | while (ntest--) { 62 | // Initialize board 63 | fscanf(spoj_p_in, "%d", &n); 64 | s.clear(); 65 | FOR(i,1,n) FOR(j,1,n) s.insert(MP(i,j)); 66 | 67 | // Read student's move sequence 68 | int want; 69 | if (fscanf(spoj_t_out, "%d", &want) != 1) { 70 | break; 71 | } 72 | 73 | bool ok = true; 74 | FOR(i,1,want) { 75 | // Move from (u0, v0) to (u2, v2) through (u1, v1) 76 | int u0, v0, u1, v1, u2, v2; 77 | if (fscanf(spoj_t_out, "%d%d%d%d", &u0, &v0, &u2, &v2) != 4) { 78 | ok = false; 79 | break; 80 | } 81 | u1 = (u0 + u2) / 2; 82 | v1 = (v0 + v2) / 2; 83 | 84 | // Check states of (u0, v0), (u1, v1) and (u2, v2) 85 | if (s.find(MP(u0,v0)) == s.end()) { 86 | ok = false; 87 | } 88 | if (s.find(MP(u1, v1)) == s.end()) { 89 | ok = false; 90 | } 91 | if (s.find(MP(u2, v2)) != s.end()) { 92 | ok = false; 93 | } 94 | 95 | // Switch to new state 96 | if (!ok) continue; 97 | s.erase(MP(u0, v0)); 98 | s.erase(MP(u1, v1)); 99 | s.insert(MP(u2, v2)); 100 | } 101 | if (ok) { 102 | int can = n*n - min_left(n); 103 | long double t = want / (long double) can; 104 | if (want == can) score += 1; 105 | else score += 0.7 * t * t * t; 106 | } 107 | } 108 | 109 | // Output total score 110 | fprintf(spoj_score, "%.5lf", score); 111 | return 0; 112 | } 113 | -------------------------------------------------------------------------------- /checker/GRAPH-11908.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | /*FILE *spoj_p_in, *spoj_p_out, *spoj_t_out; 11 | #define PIN "in.txt" 12 | #define POUT "ans.txt" 13 | #define TOUT "out.txt" 14 | 15 | void spoj_init() 16 | { 17 | spoj_p_in=fopen(PIN, "r"); 18 | spoj_p_out=fopen(POUT, "r"); 19 | spoj_t_out=fopen(TOUT, "r"); 20 | } 21 | 22 | #define spoj_assert assert*/ 23 | 24 | class ConstantArray // Eli Bendersky 25 | { 26 | public: 27 | ConstantArray(size_t len_, int init_val_ = 0) 28 | { 29 | vec = new int[len_]; 30 | 31 | from = new size_t[len_]; 32 | to = new size_t[len_]; 33 | top = 0; 34 | init_val = init_val_; 35 | len = len_; 36 | } 37 | 38 | int& operator[](size_t n) 39 | { 40 | if (from[n] < top && to[from[n]] == n) 41 | return vec[n]; 42 | else 43 | { 44 | from[n] = top; 45 | to[top] = n; 46 | vec[n] = init_val; 47 | top++; 48 | 49 | return vec[n]; 50 | } 51 | } 52 | 53 | ~ConstantArray() 54 | { 55 | delete[] vec; 56 | delete[] from; 57 | delete[] to; 58 | } 59 | 60 | private: 61 | int* vec; 62 | size_t* from; 63 | size_t* to; 64 | size_t top; 65 | int init_val; 66 | size_t len; 67 | }; 68 | 69 | int n, u, v, k, m; 70 | char ins[10], ans[10]; 71 | ConstantArray *c=0; 72 | #define POS(i,j) ((i-1)*n+(j-1)) 73 | 74 | int main() 75 | { 76 | spoj_init(); 77 | while (1) { 78 | fscanf(spoj_p_in, "%s", ins); 79 | if (strcmp(ins, "NEW")==0) { 80 | fscanf(spoj_p_in, "%d%d", &n,&k); 81 | spoj_assert(k==0 || k==1); 82 | if (c!=0) delete c; 83 | if (k==0) { 84 | c=new ConstantArray(n*n,0); 85 | m=0; 86 | } 87 | else { 88 | c=new ConstantArray(n*n,1); 89 | m=n*n; 90 | } 91 | 92 | } else if (strcmp(ins, "ANY")==0) { 93 | if (m==0) { 94 | spoj_assert(fscanf(spoj_t_out, "%d", &u)==1); 95 | spoj_assert(u==-1); 96 | } else { 97 | spoj_assert(fscanf(spoj_t_out, "%d%d", &u, &v)==2); 98 | spoj_assert((*c)[POS(u,v)]==1); 99 | --m; 100 | (*c)[POS(u,v)]=0; 101 | } 102 | } else if (strcmp(ins, "ADD")==0) { 103 | fscanf(spoj_p_in, "%d%d", &u, &v); 104 | if ((*c)[POS(u,v)]==0) { 105 | ++m; 106 | (*c)[POS(u,v)]=1; 107 | } 108 | } else if (strcmp(ins, "DEL")==0) { 109 | fscanf(spoj_p_in, "%d%d", &u, &v); 110 | if ((*c)[POS(u,v)]==1) { 111 | --m; 112 | (*c)[POS(u,v)]=0; 113 | } 114 | } else if (strcmp(ins, "EDG")==0) { 115 | fscanf(spoj_p_in, "%d%d", &u, &v); 116 | spoj_assert(fscanf(spoj_t_out, "%s", ans)==1); 117 | spoj_assert(strcmp(ans,"YES")==0 || strcmp(ans,"NO")==0); 118 | spoj_assert((*c)[POS(u,v)]==((strcmp(ans,"YES")==0))); 119 | } else if (strcmp(ins, "END")==0) { 120 | break; 121 | } 122 | } 123 | return 0; 124 | } 125 | -------------------------------------------------------------------------------- /checker/VMCROSS-10876.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace std; 29 | int n,m,K,cnt[55][55],ans,used[1005]; 30 | vector dict; 31 | set exist; 32 | char grid[55][55],tmp[55]; 33 | int X,Y,Z,T; 34 | bool ngang[55][55], doc[55][55]; 35 | 36 | void row(string S,int u,int v) 37 | { 38 | spoj_assert(!ngang[u][v-1]); 39 | spoj_assert(v+S.length()-1 <= 50); 40 | spoj_assert(!ngang[u][v+S.length()]); 41 | 42 | for(int i=0; i=1 && n<=50); 72 | spoj_assert(m>=1 && m<=50); 73 | spoj_assert(K>=1 && K<=1000); 74 | for(int i=1; i<=K; i++) 75 | { 76 | fscanf(spoj_p_in,"%s",tmp); 77 | spoj_assert(!exist.count(string(tmp))); 78 | 79 | int l = strlen(tmp); 80 | spoj_assert(4 <= l && l <= 30); 81 | exist.insert(tmp); 82 | dict.push_back(string(tmp)); 83 | } 84 | for(int i=1; i<=n; i++) 85 | for(int j=1; j<=m; j++) grid[i][j]='.'; 86 | } 87 | void readoutput() 88 | { 89 | int id,u,v,t; 90 | spoj_assert(fscanf(spoj_t_out,"%d",&ans)==1); 91 | spoj_assert(ans>=0 && ans<=K); 92 | for(int i=1; i<=ans; i++) 93 | { 94 | spoj_assert(fscanf(spoj_t_out,"%d %d %d %d",&id,&u,&v,&t)==4); 95 | spoj_assert(id>=1 && id<=K); 96 | spoj_assert(!used[id]); used[id]++; 97 | spoj_assert(u>=1 && u<=n); 98 | spoj_assert(v>=1 && v<=m); 99 | spoj_assert(t==0 || t==1); 100 | if(t==0) X++; 101 | else Y++; 102 | if(t==0) row(dict[id-1],u,v); 103 | else col(dict[id-1],u,v); 104 | } 105 | } 106 | void scoring() 107 | { 108 | for(int i=1; i<=n; i++) 109 | for(int j=1; j<=m; j++) 110 | if(cnt[i][j]==2) Z++; 111 | else if(cnt[i][j]==1) T++; 112 | T+=Z; 113 | fprintf(spoj_score,"%.2lf\n",1.0*(X*Y+sqrt(Z*Z*Z)+T)/(1.0*n*m)); 114 | cerr << X << ' ' << Y << ' ' << Z << ' ' << T << endl; 115 | } 116 | int main() 117 | { 118 | spoj_init(); 119 | readinput(); 120 | readoutput(); 121 | scoring(); 122 | return 0; 123 | } 124 | -------------------------------------------------------------------------------- /cogs/BotControlCommand.py: -------------------------------------------------------------------------------- 1 | from discord.ext import commands 2 | import discord 3 | import asyncio 4 | import os 5 | import time 6 | import subprocess 7 | import textwrap 8 | import sys 9 | from helper import helper 10 | # Adapted from TLE sources. 11 | # https://github.com/cheran-senthil/TLE/blob/master/tle/cogs/meta.py#L15 12 | 13 | 14 | def git_history(): 15 | def _minimal_ext_cmd(cmd): 16 | # construct minimal environment 17 | env = {} 18 | for k in ['SYSTEMROOT', 'PATH']: 19 | v = os.environ.get(k) 20 | if v is not None: 21 | env[k] = v 22 | # LANGUAGE is used on win32 23 | env['LANGUAGE'] = 'C' 24 | env['LANG'] = 'C' 25 | env['LC_ALL'] = 'C' 26 | out = subprocess.Popen( 27 | cmd, stdout=subprocess.PIPE, env=env).communicate()[0] 28 | return out 29 | try: 30 | out = _minimal_ext_cmd(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) 31 | branch = out.strip().decode('ascii') 32 | out = _minimal_ext_cmd(['git', 'log', '--oneline', '-5']) 33 | history = out.strip().decode('ascii') 34 | return ( 35 | 'Branch:\n' + 36 | textwrap.indent(branch, ' ') + 37 | '\nCommits:\n' + 38 | textwrap.indent(history, ' ') 39 | ) 40 | except OSError: 41 | return "Fetching git info failed" 42 | 43 | 44 | class BotControlCommand(commands.Cog): 45 | def __init__(self, bot): 46 | self.bot = bot 47 | self.start_time = time.time() 48 | 49 | # @commands.Cog.listener() 50 | # async def on_ready(self): 51 | # pass 52 | 53 | @commands.command(brief="Check if bot is still alive. Also prints bot uptime.") 54 | async def ping(self, ctx): 55 | await ctx.send("I have been running for " + 56 | helper.pretty_time_format(time.time() - self.start_time)) 57 | 58 | @commands.command(brief="Kill bot. ") 59 | @commands.is_owner() 60 | async def kill(self, ctx): 61 | """Kill bot""" 62 | await ctx.send("Dying") 63 | exit(0) 64 | 65 | @commands.command(brief='Restart bot') 66 | @commands.is_owner() 67 | async def restart(self, ctx): 68 | await ctx.send('Restarting...') 69 | os.execv(sys.executable, [sys.executable] + sys.argv) 70 | 71 | @commands.command(brief="Update bot & restart") 72 | @commands.is_owner() 73 | async def update_restart(self, ctx): 74 | await self.git_pull(ctx) 75 | await self.restart(ctx) 76 | 77 | @commands.command(brief='Get git information') 78 | async def git(self, ctx): 79 | """Replies with git information.""" 80 | await ctx.send('```yaml\n' + git_history() + '```') 81 | 82 | @commands.command(brief='Incorporates changes from the remote repository') 83 | @commands.is_owner() 84 | async def git_pull(self, ctx): 85 | mess = await ctx.send('Getting changes from the remote repository...') 86 | result = subprocess.run( 87 | ['git', 'pull'], stdout=subprocess.PIPE).stdout.decode('utf-8').strip() 88 | await mess.edit(content='```\n' + result + '\n```') 89 | 90 | 91 | def setup(bot): 92 | bot.add_cog(BotControlCommand(bot)) 93 | -------------------------------------------------------------------------------- /checker/VMSQ-6796.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) 18 | #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--) 19 | #define REP(i,a) for(int i=0,_a=(a); i<_a; i++) 20 | #define ll long long 21 | #define F first 22 | #define S second 23 | #define PB push_back 24 | #define MP make_pair 25 | using namespace std; 26 | 27 | const double PI = acos(-1.0); 28 | 29 | /* 30 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 31 | #define PIN "6.in" 32 | #define POUT "2.in" 33 | #define TOUT "output.txt" 34 | #define SCORE "result.txt" 35 | 36 | void spoj_init() 37 | { 38 | spoj_p_in=fopen(PIN, "r"); 39 | spoj_p_out=fopen(POUT, "r"); 40 | spoj_t_out=fopen(TOUT, "r"); 41 | spoj_score=fopen(SCORE, "w"); 42 | } 43 | 44 | #define spoj_assert assert 45 | */ 46 | 47 | int n; 48 | int a[111][111]; 49 | int b[111][111]; 50 | const int MAXN = 50; 51 | vector< pair > ls; 52 | 53 | long double getScore() { 54 | long long cnt = 0, sumdist = 0; 55 | FOR(i,1,n) FOR(j,1,n) { 56 | if (a[i][j] < 0 && b[i][j] > 0) ++cnt; 57 | } 58 | FOR(x,1,n) { 59 | ls.clear(); 60 | long long cur = 0; 61 | FOR(i,1,n) FOR(j,1,n) if (b[i][j] == x) ls.PB(MP(i,j)); 62 | REP(i,ls.size()) REP(j,i) 63 | cur += abs(ls[i].F - ls[j].F) + abs(ls[i].S - ls[j].S); 64 | sumdist += cur; 65 | } 66 | int empty = 0; 67 | FOR(i,1,n) FOR(j,1,n) if (a[i][j] < 0) ++empty; 68 | if (empty == 0) return 0.0; 69 | long double t = cnt * cnt * sumdist / (long double) empty / empty / n / n / n / n; 70 | return t*t*t*100; 71 | } 72 | 73 | bool check(int a[][111]) { 74 | FOR(i,1,n) 75 | FOR(j1,1,n) FOR(j2,j1+1,n) 76 | if (a[i][j1] > 0 && a[i][j2] > 0) 77 | if (a[i][j1] == a[i][j2]) return false; 78 | FOR(j,1,n) 79 | FOR(i1,1,n) FOR(i2,i1+1,n) 80 | if (a[i1][j] > 0 && a[i2][j] > 0) 81 | if (a[i1][j] == a[i2][j]) return false; 82 | return true; 83 | } 84 | 85 | int main() { 86 | spoj_init(); 87 | // Read & check input file 88 | spoj_assert(fscanf(spoj_p_in, "%d", &n) == 1); 89 | spoj_assert(1 <= n && n <= MAXN); 90 | FOR(i,1,n) FOR(j,1,n) { 91 | spoj_assert(fscanf(spoj_p_in, "%d", &a[i][j]) == 1); 92 | spoj_assert(a[i][j] == -1 || (1 <= a[i][j] && a[i][j] <= n)); 93 | } 94 | 95 | // Read & check output file 96 | FOR(i,1,n) FOR(j,1,n) { 97 | spoj_assert(fscanf(spoj_t_out, "%d", &b[i][j]) == 1); 98 | spoj_assert(b[i][j] == -1 || (1 <= b[i][j] && b[i][j] <= n)); 99 | spoj_assert(a[i][j] < 0 || a[i][j] == b[i][j]); 100 | } 101 | 102 | // Check validity of boards 103 | spoj_assert(check(a)); 104 | spoj_assert(check(b)); 105 | 106 | // Get score 107 | fprintf(spoj_score, "%.5lf\n", (double)getScore()); 108 | return 0; 109 | } 110 | -------------------------------------------------------------------------------- /helper/database.py: -------------------------------------------------------------------------------- 1 | import json 2 | _PREFIX_ = 'voj-' 3 | 4 | 5 | class DataUser: 6 | def __init__(self): 7 | self.file_path = 'database/user_database.json' 8 | 9 | def load(self): 10 | with open(self.file_path, "r", encoding="utf-8") as json_file: 11 | return json.load(json_file) 12 | 13 | def save(self, cur): 14 | with open(self.file_path, "w", encoding="utf-8") as json_file: 15 | json.dump(cur, json_file) 16 | 17 | def set(self, id_discord, username_polygon): 18 | id_discord = str(id_discord) 19 | cur = self.load() 20 | if id_discord in cur: 21 | cur.pop(id_discord) 22 | cur[id_discord] = username_polygon 23 | self.save(cur) 24 | 25 | def get(self, id_discord): 26 | id_discord = str(id_discord) 27 | cur = self.load() 28 | if id_discord in cur: 29 | return cur[id_discord] 30 | return None 31 | 32 | def list(self): 33 | return self.load() 34 | 35 | 36 | def format_name(problem_name): 37 | problem_name = problem_name.upper().strip() 38 | if problem_name.find('VOJ-') == 0: 39 | problem_name = problem_name[4:] 40 | problem_name = problem_name.replace('_', '-') 41 | return problem_name 42 | 43 | 44 | class DeletedProblem: 45 | def __init__(self): 46 | self.file_path = 'database/deleted_problems.json' 47 | 48 | def load(self): 49 | with open(self.file_path, "r", encoding="utf-8") as json_file: 50 | return json.load(json_file) 51 | 52 | def save(self, cur): 53 | with open(self.file_path, "w", encoding="utf-8") as json_file: 54 | json.dump(cur, json_file) 55 | 56 | def is_deleted(self, problem_name): 57 | 58 | problem_name = format_name(problem_name) 59 | return problem_name in self.load() 60 | 61 | def set(self, problem_name, reason): 62 | cur = self.load() 63 | problem_name = format_name(problem_name) 64 | cur[problem_name] = reason 65 | self.save(cur) 66 | 67 | def restore(self, problem_name): 68 | cur = self.load() 69 | problem_name = format_name(problem_name) 70 | cur.pop(problem_name, None) 71 | self.save(cur) 72 | 73 | def list(self): 74 | return self.load() 75 | 76 | 77 | class ProblemGave: 78 | def __init__(self, is_review=False): 79 | self.file_path = 'database/problem_gave_database.json' 80 | if is_review: 81 | self.file_path = 'database/reviewed_database.json' 82 | 83 | def load(self): 84 | with open(self.file_path, "r", encoding="utf-8") as json_file: 85 | return json.load(json_file) 86 | 87 | def save(self, cur): 88 | with open(self.file_path, "w", encoding="utf-8") as json_file: 89 | json.dump(cur, json_file) 90 | 91 | def set(self, problem_name, username_polygon): 92 | cur = self.load() 93 | problem_name = format_name(problem_name) 94 | cur[problem_name] = username_polygon 95 | self.save(cur) 96 | 97 | def get(self, problem_name): 98 | problem_name = format_name(problem_name) 99 | 100 | cur = self.load() 101 | if problem_name in cur: 102 | return cur[problem_name] 103 | return None 104 | -------------------------------------------------------------------------------- /checker/VMPHQUA-10849.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++) 29 | #define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--) 30 | #define REP(i,a) for(int i=0,_a=(a); i<_a; i++) 31 | 32 | #define DEBUG(x) { cout << #x << " = "; cout << (x) << endl; } 33 | #define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; } 34 | #define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; } 35 | using namespace std; 36 | 37 | const int MAXN = 500; 38 | const int MAXV = 50; 39 | const int MAXD = 40000; 40 | const int MAXX = 10000; 41 | 42 | int n, v, c; 43 | int d[MAXN + 11]; 44 | double x[MAXN + 11], y[MAXN + 11], Y, X; 45 | bool marked[MAXN + 11]; 46 | 47 | inline double sqr(double x) { return x*x; } 48 | 49 | void readInput() { 50 | spoj_assert(fscanf(spoj_p_in, "%d%d%d", &n, &v, &c) == 3); 51 | spoj_assert(1 <= n && n <= MAXN); 52 | spoj_assert(1 <= v && v <= MAXV); 53 | spoj_assert(1 <= c && c <= MAXD); 54 | 55 | for(int i = 0; i < n; ++i) { 56 | spoj_assert(fscanf(spoj_p_in, "%d%lf%lf", &d[i], &x[i], &y[i]) == 3); 57 | if (i == 0) { 58 | spoj_assert(d[i] == 0); 59 | } else { 60 | spoj_assert(d[i] > 0 && d[i] <= MAXD); 61 | } 62 | spoj_assert(-MAXX <= x[i] && x[i] <= MAXX); 63 | spoj_assert(-MAXX <= y[i] && y[i] <= MAXX); 64 | } 65 | } 66 | 67 | void readOutput() { 68 | X = 0; 69 | for(int i = 0; i < v; ++i) { 70 | int u; 71 | spoj_assert(fscanf(spoj_t_out, "%d", &u) == 1); 72 | spoj_assert(u == 0); 73 | 74 | vector cur; cur.push_back(u); 75 | spoj_assert(fscanf(spoj_t_out, "%d", &u) == 1); 76 | 77 | while (u) { 78 | cur.push_back(u); 79 | spoj_assert(fscanf(spoj_t_out, "%d", &u) == 1); 80 | } 81 | cur.push_back(u); 82 | 83 | // PR0(cur, cur.size()); 84 | 85 | REP(t, cur.size() - 1) { 86 | int u = cur[t], v = cur[t+1]; 87 | X += sqrt(sqr(x[u] - x[v]) + sqr(y[u] - y[v])); 88 | } 89 | 90 | // Check if every point visit <= 1 time 91 | int sum = 0; 92 | FOR(t,1,cur.size()-2) { 93 | spoj_assert(marked[cur[t]] == false); 94 | marked[cur[t]] = true; 95 | 96 | sum += d[cur[t]]; 97 | } 98 | spoj_assert(sum <= c); 99 | } 100 | 101 | // Check if every point visit >= 1 time 102 | for(int i = 1; i < n; ++i) { 103 | spoj_assert(marked[i]); 104 | } 105 | // DEBUG(X); 106 | } 107 | 108 | void readOptimal() { 109 | spoj_assert(fscanf(spoj_p_out, "%lf", &Y) == 1); 110 | // DEBUG(Y); 111 | } 112 | 113 | int main() { 114 | spoj_init(); 115 | readInput(); 116 | readOutput(); 117 | readOptimal(); 118 | 119 | fprintf(spoj_score, "%.4lf\n", min(Y / X, 3.0)); 120 | } 121 | -------------------------------------------------------------------------------- /checker/C11BC0-6039.pas: -------------------------------------------------------------------------------- 1 | {$R-,Q-} 2 | const fi = ''; 3 | fo = ''; 4 | vc = 790972; 5 | var 6 | f : text; 7 | a,c : array[0..100000] of int64; 8 | b,d : array[0..100000] of int64; 9 | key,n,i,j,h,k,first,last,i1 : longint; 10 | res,res1,s : int64; 11 | procedure quick(l1,r1 : longint); 12 | var 13 | i1,j1,temp,pivot : longint; 14 | begin 15 | if l1 >= r1 then exit; 16 | pivot := B[(l1 + r1) div 2]; 17 | i1 := l1; 18 | j1 := r1; 19 | repeat 20 | While b[i1] < pivot do inc(i1); 21 | while b[j1] > pivot do dec(j1); 22 | if i1 <= j1 then 23 | begin 24 | if i1 < j1 then 25 | begin 26 | temp := a[i1]; 27 | a[i1] := a[j1]; 28 | a[j1] := temp; 29 | temp := b[i1]; 30 | b[i1] := b[j1]; 31 | b[j1] := temp; 32 | End; 33 | inc(i1); 34 | dec(j1); 35 | End; 36 | Until i1 > j1; 37 | quick(l1,j1); 38 | quick(i1,r1); 39 | End; 40 | function tinh(l1,r1 : longint) : int64; 41 | begin 42 | j := 0; 43 | b[0] := 0; 44 | d[0] := 0; 45 | for i := l1 to r1 do 46 | Begin 47 | inc(j); 48 | b[j] := b[j-1] + a[i]; 49 | D[j] := d[j-1] + a[i]*b[j-1]; 50 | End; 51 | 52 | For h := 2 to k do 53 | begin 54 | j := 0; 55 | for i := l1 to r1 do 56 | begin 57 | inc(j); 58 | b[j] := d[j] mod vc; 59 | d[j] := d[j-1] + a[i]*b[j-1]; 60 | End; 61 | End; 62 | tinh := b[j] mod vc; 63 | End; 64 | begin 65 | assign(f,fi); 66 | reset(f); 67 | readln(f,n,k); 68 | For i := 1 to n do 69 | readln(f,a[i],b[i]); 70 | Close(f); 71 | quick(1,n); 72 | key := 0; 73 | For i := 1 to n do 74 | if (i = 1) or ((i > 1) and (b[i] <> b[i-1])) then 75 | begin 76 | inc(key); 77 | c[i] := key; 78 | End 79 | else c[i] := key; 80 | res := tinh(1,n); 81 | For i1 := 1 to n do 82 | Begin 83 | if (i1 = 1) or (c[i1] <> c[i1-1]) then first := i1; 84 | if (i1 = n) or (c[i1] <> c[i1+1]) then 85 | Begin 86 | last := i1; 87 | res1 := tinh(first,last); 88 | res := (res mod vc) - (res1 mod vc); 89 | if res < 0 then res := res + vc; 90 | End; 91 | End; 92 | Assign(f,fo); 93 | rewrite(f); 94 | writeln(f,res mod vc); 95 | Close(f); 96 | End. 97 | -------------------------------------------------------------------------------- /helper/paginator.py: -------------------------------------------------------------------------------- 1 | # source: https://github.com/cheran-senthil/TLE/blob/master/tle/util/paginator.py 2 | import asyncio 3 | import functools 4 | import discord 5 | 6 | _REACT_FIRST = '\N{BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR}' 7 | _REACT_PREV = '\N{BLACK LEFT-POINTING TRIANGLE}' 8 | _REACT_NEXT = '\N{BLACK RIGHT-POINTING TRIANGLE}' 9 | _REACT_LAST = '\N{BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR}' 10 | 11 | _CHARS_PER_PAGE = 1500 12 | _PAGINATE_WAIT_TIME = 1 * 60 # 1 minute 13 | 14 | 15 | def chunkify(sequence, chunk_size): 16 | """Utility method to split a sequence into fixed size chunks.""" 17 | return [sequence[i: i + chunk_size] for i in range(0, len(sequence), chunk_size)] 18 | 19 | 20 | class PaginatorError(Exception): 21 | pass 22 | 23 | 24 | class NoPagesError(PaginatorError): 25 | pass 26 | 27 | 28 | class InsufficientPermissionsError(PaginatorError): 29 | pass 30 | 31 | 32 | class Paginated: 33 | def __init__(self, pages): 34 | self.pages = pages 35 | self.cur_page = None 36 | self.message = None 37 | self.reaction_map = { 38 | _REACT_FIRST: functools.partial(self.show_page, 1), 39 | _REACT_PREV: self.prev_page, 40 | _REACT_NEXT: self.next_page, 41 | _REACT_LAST: functools.partial(self.show_page, len(pages)) 42 | } 43 | 44 | async def show_page(self, page_num): 45 | if 1 <= page_num <= len(self.pages): 46 | content, embed = self.pages[page_num - 1] 47 | await self.message.edit(content=content, embed=embed) 48 | self.cur_page = page_num 49 | 50 | async def prev_page(self): 51 | await self.show_page(self.cur_page - 1) 52 | 53 | async def next_page(self): 54 | await self.show_page(self.cur_page + 1) 55 | 56 | async def paginate(self, bot, channel, wait_time): 57 | content, embed = self.pages[0] 58 | self.message = await channel.send(content, embed=embed) 59 | 60 | if len(self.pages) == 1: 61 | # No need to paginate. 62 | return 63 | 64 | self.cur_page = 1 65 | for react in self.reaction_map.keys(): 66 | await self.message.add_reaction(react) 67 | 68 | def check(reaction, user): 69 | return (bot.user != user and 70 | reaction.message.id == self.message.id and 71 | reaction.emoji in self.reaction_map) 72 | 73 | while True: 74 | try: 75 | reaction, user = await bot.wait_for('reaction_add', timeout=wait_time, check=check) 76 | await reaction.remove(user) 77 | await self.reaction_map[reaction.emoji]() 78 | except asyncio.TimeoutError: 79 | await self.message.clear_reactions() 80 | break 81 | 82 | 83 | def make_pages(message, title): 84 | chunks = chunkify(message, _CHARS_PER_PAGE) 85 | pages = [] 86 | 87 | for chunk in chunks: 88 | embed = discord.Embed(description=chunk) 89 | pages.append((title, embed)) 90 | return pages 91 | 92 | 93 | def paginate(bot, channel, message, title): 94 | pages = make_pages(message, title) 95 | if len(pages) > 1: 96 | for i, (content, embed) in enumerate(pages): 97 | embed.set_footer(text=f'Page {i + 1} / {len(pages)}') 98 | paginated = Paginated(pages) 99 | asyncio.create_task(paginated.paginate(bot, channel, _PAGINATE_WAIT_TIME)) 100 | -------------------------------------------------------------------------------- /services/Polygon.py: -------------------------------------------------------------------------------- 1 | import requests, random, hashlib, time 2 | from urllib.parse import urlparse, parse_qs 3 | 4 | BASE_URL = 'https://polygon.codeforces.com' 5 | 6 | class PolygonInteractor: 7 | def __init__(self, username, password, api_key, api_secret): 8 | self.username = username 9 | self.password = password 10 | self.api_key = api_key 11 | self.api_secret = api_secret 12 | 13 | s = requests.session() 14 | s.allow_redirects = False 15 | 16 | # For debugging 17 | # s.proxies = {'http': 'http://localhost:8888', 'https': 'http://localhost:8888'} 18 | # s.verify = False 19 | 20 | self.s = s 21 | 22 | self.login() 23 | 24 | def extract_ccid(self, text): 25 | return text.split('name="ccid" content="')[1].split('"')[0] 26 | 27 | #login with self.username & self.password 28 | def login(self): 29 | r = self.s.get(BASE_URL + '/login') 30 | ccid = self.extract_ccid(r.text) 31 | self.ccid = ccid 32 | 33 | data = { 34 | 'login': self.username, 35 | 'password': self.password, 36 | 'submit': 'Login', 37 | 'submitted': 'true' 38 | } 39 | 40 | params = { 41 | 'ccid': ccid 42 | } 43 | 44 | r1 = self.s.post(BASE_URL + '/login', data=data, params=params, allow_redirects=False) 45 | 46 | if r1.status_code != 302: 47 | return False 48 | 49 | print(self.username + " logged to polygon") 50 | return True 51 | 52 | def get_session_id(self, problem_id): 53 | data = {'problemId': problem_id} 54 | params = {'ccid': self.ccid} 55 | 56 | continue_edit_request = self.s.post(BASE_URL + '/edit-start', data=data, params=params, allow_redirects=False) 57 | 58 | session = parse_qs(urlparse(continue_edit_request.headers['location']).query)['session'][0] 59 | 60 | return session 61 | 62 | def request_unofficial(self, method_name, data={}, params={}, method='GET'): 63 | data['ccid'] = self.ccid 64 | 65 | if not ('session' in data and data['session']): 66 | data['session'] = self.get_session_id(data['problemId']) 67 | 68 | return self.s.request(method, BASE_URL + '/' + method_name, files=data, params=params, allow_redirects=False) 69 | 70 | def request_official(self, method_name, data=None, params=None, method='POST'): 71 | if params is None: 72 | params = {} 73 | if data is None: 74 | data = {} 75 | 76 | params["apiKey"] = self.api_key 77 | params["time"] = int(time.time()) 78 | 79 | signature_random = ''.join([chr(random.SystemRandom().randint(0, 25) + ord('a')) for _ in range(6)]) 80 | signature_random = signature_random.encode('utf-8') 81 | 82 | for i in params: 83 | params[i] = str(params[i]).encode('utf-8') 84 | param_list = [(key.encode('utf-8'), params[key]) for key in params] 85 | param_list.sort() 86 | 87 | signature_string = signature_random + b'/' + method_name.encode('utf-8') 88 | signature_string += b'?' + b'&'.join([i[0] + b'=' + i[1] for i in param_list]) 89 | signature_string += b'#' + self.api_secret.encode('utf-8') 90 | params["apiSig"] = signature_random + hashlib.sha512(signature_string).hexdigest().encode('utf-8') 91 | url = BASE_URL + '/api/' + method_name 92 | 93 | return self.s.request(method, url, files=params) 94 | 95 | def get_problem_list(self): 96 | return self.request_official('problems.list').json()['result'] 97 | 98 | def give_access(self, problem_id, usernames, write=False, session=None): 99 | # give username permission to problem 100 | 101 | data = { 102 | 'problemId': str(problem_id), 103 | 'submitted': 'true', 104 | 'users_added': ','.join(usernames), 105 | 'type': 'Write' if write else 'Read', 106 | 'session': session 107 | } 108 | 109 | r = self.request_unofficial('access', data=data, params={'action': 'add'}, method='POST') 110 | return 'location' in r.headers and 'access' in r.headers['location'] -------------------------------------------------------------------------------- /checker/MAKHOA2-5959.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | using namespace std; 18 | 19 | const int MAXN = 100; 20 | const double MAX_SCORE = 2.5; 21 | 22 | 23 | #include 24 | /* 25 | #include 26 | FILE *spoj_p_in, *spoj_t_out, *spoj_score; 27 | #define PIN "10.in" 28 | #define TOUT "10.out" 29 | #define SCORE "result.txt" 30 | 31 | void spoj_init() { 32 | spoj_p_in = fopen(PIN, "r"); 33 | spoj_t_out = fopen(TOUT, "r"); 34 | spoj_score = fopen(SCORE, "w"); 35 | } 36 | #define spoj_assert assert 37 | */ 38 | int nRow, nCol; 39 | vector row[MAXN], col[MAXN]; 40 | string solution[MAXN]; 41 | 42 | bool equal(vector a, vector b) { 43 | if (a.size() != b.size()) return false; 44 | 45 | for(int i = 0; i < a.size(); i++) { 46 | if (a[i] != b[i]) return false; 47 | } 48 | return true; 49 | } 50 | 51 | int get() { 52 | for(int i = 1; i <= nRow; i++) 53 | if (solution[i].length() != nCol + 1) return 0; 54 | 55 | for(int i = 1; i <= nRow; i++) { 56 | for(int j = 1; j <= nCol; j++) 57 | if (solution[i][j] < '0' || solution[i][j] > '1') return 0; 58 | } 59 | 60 | int res = 0; 61 | 62 | for(int i = 1; i <= nRow; i++) { 63 | string now = solution[i]; 64 | for(int x = 0; x < now.length(); x++) 65 | if (now[x] == '0') now[x] = ' '; 66 | istringstream sin(now); 67 | vector cur; 68 | string u; 69 | while (sin >> u) { 70 | cur.push_back(u.length()); 71 | } 72 | if (equal(cur, row[i])) res++; 73 | } 74 | 75 | for(int j = 1; j <= nCol; j++) { 76 | string now = ""; 77 | for(int i = 1; i <= nRow; i++) 78 | now = now + solution[i][j]; 79 | for(int x = 0; x < now.length(); x++) 80 | if (now[x] == '0') now[x] = ' '; 81 | istringstream sin(now); 82 | vector cur; 83 | string u; 84 | while (sin >> u) { 85 | cur.push_back(u.length()); 86 | } 87 | if (equal(cur, col[j])) res++; 88 | } 89 | return res; 90 | } 91 | 92 | void read_input() { 93 | fscanf(spoj_p_in, "%d %d", &nRow, &nCol); 94 | spoj_assert(nRow >= 1 && nCol >= 1 && nRow < MAXN && nCol < MAXN); 95 | 96 | if (nRow != nCol) { 97 | cout << "Warning: Number of row != number of column"; 98 | } 99 | 100 | int sumRow = 0, sumCol = 0; 101 | for(int i = 1; i <= nRow; i++) { 102 | int k; 103 | fscanf(spoj_p_in, "%d", &k); 104 | while (k--) { 105 | int u; 106 | fscanf(spoj_p_in, "%d", &u); 107 | row[i].push_back(u); 108 | sumRow += u; 109 | } 110 | } 111 | 112 | for(int j = 1; j <= nCol; j++) { 113 | int k; 114 | fscanf(spoj_p_in, "%d", &k); 115 | while (k--) { 116 | int u; 117 | fscanf(spoj_p_in, "%d", &u); 118 | col[j].push_back(u); 119 | sumCol += u; 120 | } 121 | } 122 | 123 | spoj_assert(sumRow == sumCol); 124 | } 125 | 126 | void read_output() { 127 | for(int i = 1; i <= nRow; i++) { 128 | char tmp[211]; 129 | fscanf(spoj_t_out, "%s\n", &tmp); 130 | spoj_assert(strlen(tmp) == nCol); 131 | solution[i] = " "; 132 | 133 | for(int x = 0; x < strlen(tmp); x++) { 134 | spoj_assert(tmp[x] == '0' || tmp[x] == '1'); 135 | solution[i] += tmp[x]; 136 | } 137 | } 138 | } 139 | 140 | int main() { 141 | spoj_init(); 142 | 143 | read_input(); 144 | read_output(); 145 | 146 | int result = get(); 147 | if (result <= max(nRow, nCol)) fprintf(spoj_score, "0"); 148 | else if (result == nRow + nCol) fprintf(spoj_score, "%0.6lf", MAX_SCORE); 149 | else fprintf(spoj_score, "%0.6lf", (result * 1.0 - max(nRow, nCol)) / (nRow + nCol - max(nRow, nCol)) * (MAX_SCORE - 0.5) + 0.5); 150 | return 0; 151 | } 152 | -------------------------------------------------------------------------------- /checker/VMMAZE-6902.cpp: -------------------------------------------------------------------------------- 1 | #include "spoj_interactive.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | using namespace std; 17 | 18 | #define PI acos(-1) 19 | #define MP make_pair 20 | #define PB push_back 21 | #define VI vector 22 | #define PII pair 23 | #define LL long long 24 | #define SET(v,i) memset(v, i, sizeof(v)) 25 | #define FOR(i,a,b) for (int i = (a); i <= (b); i++) 26 | #define FORD(i,a,b) for (int i = (a); i >= (b); i--) 27 | #define FORN(i,a,b) for (int i = (a); i < (b); i++) 28 | #define DOWN(i,a,b) for (int i = (a); i > (b); i--) 29 | #define FIT(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); it++) 30 | #define FITD(it,v) for (typeof(v.rbegin()) it = v.rbegin(); it != v.rend(); it++) 31 | #define FREOPEN freopen("a.in", "r", stdin); freopen("a.out", "w", stdout) 32 | 33 | #define FI first 34 | #define SE second 35 | #define maxn 100 36 | 37 | int cd[] = {-1, 0, 1, 0}, cc[] = {0, 1, 0, -1};//0, 1, 2, 3 = N E S W 38 | 39 | int n, m, k; 40 | PII st, ed; 41 | PII pos[maxn]; 42 | bool used[maxn]; 43 | string MAP[maxn]; 44 | 45 | char tmp[maxn]; 46 | 47 | int main() 48 | { 49 | spoj_init(); 50 | 51 | // Read input file 52 | fscanf(spoj_p_in, "%d%d%d\n", &m, &n, &k); 53 | FOR (i, 1, m) { 54 | fscanf(spoj_p_in, "%s\n", &tmp[0]); 55 | MAP[i] = string(tmp); 56 | MAP[i] = '#' + MAP[i]; 57 | } 58 | fprintf(spoj_p_info, "Read input file: %d %d %d\n", m, n, k); 59 | 60 | // Find starting position 61 | FOR (i, 1, m) 62 | FOR (j, 1, n) 63 | if (MAP[i][j] == 'S') st.FI = i, st.SE = j, MAP[i][j] = '.'; 64 | 65 | // Initialize portals 66 | SET (used, false); 67 | 68 | // cnt = number of movements 69 | int cnt = 0; 70 | int x, y; 71 | 72 | // Print to tested's input 73 | spoj_printf("%d ", m); 74 | spoj_printf("%d ", n); 75 | spoj_printf("%d\n", k); 76 | 77 | while ( 1 ) { 78 | // Read tested's output 79 | spoj_scanf("%d", &x); 80 | fprintf(spoj_p_info, "Read: %d\n", x); 81 | 82 | // Update number of movements 83 | cnt ++; 84 | 85 | // Check for invalid inputs 86 | if (cnt > 8*m*n + 10 || x < 0 || x > 6) { 87 | return SPOJ_RV_WA; 88 | } 89 | 90 | // Move to adjacent squares 91 | if (x < 4) { 92 | st.FI += cd[x]; 93 | st.SE += cc[x]; 94 | 95 | if (MAP[st.FI][st.SE] == '#') { 96 | spoj_printf("%d ", 0); 97 | fflush(spoj_for_tested); 98 | st.FI -= cd[x]; 99 | st.SE -= cc[x]; 100 | } 101 | else if (MAP[st.FI][st.SE] == '.') { 102 | spoj_printf("%d ", 1); 103 | fflush(spoj_for_tested); 104 | } 105 | else if (MAP[st.FI][st.SE] == 'T') { 106 | spoj_printf("%d ", 999); 107 | fflush(spoj_for_tested); 108 | break; 109 | } 110 | } 111 | 112 | // Put portal at current position 113 | if (x == 4) { 114 | spoj_scanf("%d", &y); 115 | if (y < 1 || y > k) { 116 | return SPOJ_RV_WA; 117 | } 118 | if (used[y]) { 119 | spoj_printf("%d ", 0); 120 | fflush(spoj_for_tested); 121 | } 122 | else { 123 | used[y] = true; 124 | pos[y] = st; 125 | spoj_printf("%d ", 1); 126 | fflush(spoj_for_tested); 127 | } 128 | } 129 | 130 | // Remove portal from current position 131 | if (x == 5) { 132 | spoj_scanf("%d", &y); 133 | if (y < 1 || y > k) { 134 | return SPOJ_RV_WA; 135 | } 136 | if (!used[y] || pos[y] != st) { 137 | spoj_printf("%d ", 0); 138 | fflush(spoj_for_tested); 139 | } 140 | else { 141 | used[y] = false; 142 | spoj_printf("%d ", 1); 143 | fflush(spoj_for_tested); 144 | } 145 | } 146 | 147 | // Go to portal 148 | if (x == 6) { 149 | spoj_scanf("%d", &y); 150 | if (y < 1 || y > k) { 151 | return SPOJ_RV_WA; 152 | } 153 | if (!used[y]) { 154 | spoj_printf("%d ", 0); 155 | fflush(spoj_for_tested); 156 | } 157 | else { 158 | st = pos[y]; 159 | spoj_printf("%d ", 1); 160 | fflush(spoj_for_tested); 161 | } 162 | } 163 | } 164 | 165 | fprintf(spoj_score, "%.5lf", (double) (8 * m * n) / (double) (cnt)); 166 | return SPOJ_RV_AC; 167 | } 168 | -------------------------------------------------------------------------------- /checker/VMFLOW-8554.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | //#include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | #define REP(i, n) for (int i = 0; i < n; i++) 12 | #define FOR(i, a, b) for (int i = a; i <= b; i++) 13 | 14 | const int dx[4] = {-1, 0, 1, 0}; 15 | const int dy[4] = {0, 1, 0, -1}; 16 | 17 | /* 18 | FILE *spoj_p_in, *spoj_p_out, *spoj_t_out, *spoj_score; 19 | #define PIN "in.txt" 20 | #define TOUT "out.txt" 21 | #define SCORE "result.txt" 22 | 23 | void spoj_init() 24 | { 25 | spoj_p_in=fopen(PIN, "r"); 26 | spoj_t_out=fopen(TOUT, "r"); 27 | spoj_score=fopen(SCORE, "w"); 28 | } 29 | 30 | #define spoj_assert assert 31 | */ 32 | 33 | int n; 34 | char a[55][55]; 35 | int x[55][55]; 36 | bool used[55][55]; 37 | 38 | bool checkConnection(int si, int sj) { 39 | char base = a[si][sj]; 40 | queue qx; 41 | queue qy; 42 | qx.push(si); 43 | qy.push(sj); 44 | used[si][sj] = true; 45 | bool connection = false; 46 | while (!qx.empty()) { 47 | int i = qx.front(); qx.pop(); 48 | int j = qy.front(); qy.pop(); 49 | int count = 0; 50 | REP(dir, 4) if (x[i][j] & (1 << dir)) { 51 | int u = i + dx[dir]; 52 | int v = j + dy[dir]; 53 | if (used[u][v]) continue; 54 | // cerr << i << " " << j << " " << u << " " << v << " " << a[u][v] << endl; 55 | count++; 56 | spoj_assert(count <= 1); //Make sure this is a path, not a tree 57 | 58 | used[u][v] = true; 59 | if (a[u][v] == base) { //Connect to the end point 60 | connection = true; 61 | continue; 62 | } else { 63 | //must equals '.' 64 | spoj_assert(a[u][v] == '.'); 65 | //mustn't found connection 66 | spoj_assert(connection == false); 67 | a[u][v] = base + 32; 68 | qx.push(u); 69 | qy.push(v); 70 | } 71 | } 72 | } 73 | 74 | //Not connect to the end point, check again, make sure the start point must have no connection 75 | if (!connection) { 76 | spoj_assert(x[si][sj] == 0); 77 | used[si][sj] = false; 78 | } 79 | return connection; 80 | } 81 | 82 | int main() 83 | { 84 | spoj_init(); 85 | /***********Doc input *******/ 86 | fscanf(spoj_p_in, "%d", &n); 87 | FOR(i, 1, n) FOR(j, 1, n) { 88 | while (true) { 89 | fscanf(spoj_p_in, "%c", &a[i][j]); 90 | if (a[i][j] == '.') break; 91 | if ('A' <= a[i][j] && a[i][j] <= 'Z') break; 92 | } 93 | } 94 | /***********Doc input *******/ 95 | 96 | 97 | /***********Doc output *******/ 98 | memset(x, 0, sizeof(x)); 99 | FOR(i, 1, n) FOR(j, 1, n) { 100 | spoj_assert(fscanf(spoj_t_out, "%d", &x[i][j]) == 1); 101 | spoj_assert(0 <= x[i][j] && x[i][j] <= 15); 102 | } 103 | /***********Doc output *******/ 104 | 105 | 106 | /***********Check cac o trong output phai khop voi nhau *******/ 107 | FOR(i, 1, n) FOR(j, 1, n) REP(dirij, 4) { 108 | int u = i + dx[dirij]; 109 | int v = j + dy[dirij]; 110 | int diruv = (dirij + 2) % 4; 111 | 112 | bool from_ij_to_uv = (x[i][j] & (1 << dirij)); 113 | bool from_uv_to_ij = (x[u][v] & (1 << diruv)); 114 | // cerr << "Check cell " << i << " " << j << " " << (bool)(from_ij_to_uv) << " " << u << " " << v << " " << (bool)(from_uv_to_ij) << " " << x[u][v] << " " << diruv << endl; 115 | spoj_assert(from_ij_to_uv == from_uv_to_ij); 116 | } 117 | /***********Check cac o trong output phai khop voi nhau *******/ 118 | 119 | 120 | /***********Kiem tra cac duong di*******/ 121 | memset(used, false, sizeof(used)); 122 | int totalPairs = 0; 123 | int unconnectedPairs = 0; 124 | int connectedPairs = 0; 125 | FOR(i, 1, n) FOR(j, 1, n) if (a[i][j] != '.' && !used[i][j]) { 126 | if (checkConnection(i, j)) { 127 | connectedPairs++; 128 | } else { 129 | unconnectedPairs++; 130 | used[i][j] = false; 131 | } 132 | } 133 | /***********Kiem tra cac duong di*******/ 134 | 135 | spoj_assert(unconnectedPairs % 2 == 0); 136 | unconnectedPairs /= 2; 137 | totalPairs = unconnectedPairs + connectedPairs; 138 | 139 | 140 | FOR(i, 1, n) FOR(j, 1, n) if (!used[i][j]) spoj_assert(x[i][j] == 0); /*make sure there is no loop try to trick the checker*/ 141 | 142 | int totalUsed = 0; 143 | FOR(i, 1, n) FOR(j, 1, n) if (used[i][j]) totalUsed++; 144 | 145 | if (totalUsed == n * n && totalPairs == connectedPairs) { 146 | fprintf(spoj_score, "2.000000"); 147 | printf("Score = 2"); 148 | } else { 149 | fprintf(spoj_score, "%0.6lf", 1.5 * connectedPairs * totalUsed / (totalPairs * n * n)); 150 | printf("Score = %0.6lf", 1.5 * connectedPairs * totalUsed / (totalPairs * n * n)); 151 | } 152 | 153 | return 0; 154 | } 155 | --------------------------------------------------------------------------------