From 50b31cc881dbe4fb1ca581b19b12db71a6b5bcaa Mon Sep 17 00:00:00 2001 From: anhkha2003 Date: Tue, 24 Dec 2024 23:33:43 -0600 Subject: [PATCH] Allow more extensions for uploading testcases, including Polygon format --- templates/problem/data.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/problem/data.html b/templates/problem/data.html index 5682a011..9f7920d2 100644 --- a/templates/problem/data.html +++ b/templates/problem/data.html @@ -274,16 +274,19 @@ }); function isInpFile(x) { - let tail = ['.in', '.inp', '.IN', '.INP'] + let tail = ['.in', '.inp', '.txt', '.dat', '.IN', '.INP', '.TXT', '.DAT'] for (let i of tail) { if (x.endsWith(i)) { return true; } } + if (!x.includes('.') && !x.endsWith('/')) { + return true; + } return false; } function isOutFile(x) { - let tail = ['.out', '.OUT', '.ans', '.ANS'] + let tail = ['.out', '.ans', '.res', '.a', '.OUT', '.ANS', '.RES', '.A']; for (let i of tail) { if (x.endsWith(i)) { return true; @@ -296,6 +299,9 @@ e.preventDefault(); var inFiles = [], outFiles = []; for (let file of window.valid_files) { + if (file.endsWith('/')) { + continue; + } if (isInpFile(file)) { inFiles.push(file); } @@ -303,7 +309,7 @@ outFiles.push(file); } } - if (inFiles.length == 0) { + if (inFiles.length == 0 || outFiles.length == 0) { alert("No input/output files. Make sure your files' suffices are .in(p)/.out"); return false; }