Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn of non standard IO while running cf test #52

Closed
GaurangTandon opened this issue Dec 3, 2019 · 5 comments
Closed

Warn of non standard IO while running cf test #52

GaurangTandon opened this issue Dec 3, 2019 · 5 comments

Comments

@GaurangTandon
Copy link
Contributor

GaurangTandon commented Dec 3, 2019

Consider this question: https://codeforces.com/problemset/problem/35/D It uses non-standard IO.

Far too many times I find myself running cf submit immediately after cf test passes. It would be useful if cf test would warn me that the problem requires non-standard IO, so that I would add the corresponding freopen statements to my C++ source code before submitting the code instead of getting a RE on test 1.

@user202729
Copy link
Contributor

user202729 commented Dec 6, 2019

I think it makes more sense to warn in the cf parse, because cf test doesn't have access to the problem statement.

Possible patch: (will not work if Codeforces change the HTML format)

diff --git a/client/parse.go b/client/parse.go
index c562bce..4b8f0e1 100644
--- a/client/parse.go
+++ b/client/parse.go
@@ -9,6 +9,7 @@ import (
     "path/filepath"
     "regexp"
     "strings"
+    "bytes"
     "sync"
 
     "github.com/fatih/color"
@@ -66,6 +67,11 @@ func (c *Client) ParseProblem(URL, path string) (samples int, err error) {
         return
     }
 
+    if !bytes.Contains(body, []byte(`<div class="input-file"><div class="property-title">input</div>standard input</div><div class="output-file"><div class="property-title">output</div>standard output</div>`)) {
+        color.Yellow("Non standard input output format")
+    }
+
+
     for i := 0; i < len(input); i++ {
         fileIn := filepath.Join(path, fmt.Sprintf("in%v.txt", i+1))
         fileOut := filepath.Join(path, fmt.Sprintf("ans%v.txt", i+1))

@gnojus
Copy link
Contributor

gnojus commented Dec 12, 2019

That only warns you when parsing.
And when you are finally submitting this warning would be forgotten miles away.

@xalanq
Copy link
Owner

xalanq commented Feb 27, 2020

I'll add some warns when parsing

@xalanq xalanq closed this as completed in d63dd67 Feb 27, 2020
@user202729
Copy link
Contributor

There are problems with italic input/output specifier such as https://codeforces.com/gym/102354/problem/B , but is still standard input/output.

@xalanq
Copy link
Owner

xalanq commented Feb 29, 2020

There are problems with italic input/output specifier such as https://codeforces.com/gym/102354/problem/B , but is still standard input/output.

lmao haaaaaaaaha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants