Skip to content

This a try to automate codefoces submission using an endpoint

Notifications You must be signed in to change notification settings

eagledev-am/codeforces-submit-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codeforces-submit-automation

An API to submit code to CodeForces using Selenium and Spring Boot.

Java code to test the API

public class test {

    static String code = "YOUR CODE HERE";

    public static void main(String[] args) {


        WebClient client = WebClient.create("http://localhost:8080");
        SubmissionInfo problemData = new SubmissionInfo();
        problemData.solutionCode = code; // code
        problemData.compilerId = 54; // compiler

        ProblemSubmitRes res = client.post()
                .uri("submit/{PROBLEM CODE}") // add your problem code
                .body(BodyInserters.fromValue(problemData))
                .retrieve()
                .bodyToMono(ProblemSubmitRes.class)
                .block();

        System.out.println(res);

    }
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class ProblemSubmitRes {
    String verdict;
    String time;
    String memory;
    String submitTime;
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class SubmissionInfo {

    String solutionCode;

    Integer compilerId;
}

Remember To Add test code dependencies

Add webclient dependency
Add lombok dependency

Provided End-Points

  • localhost:8080/submit/{problemCode} - POST

Example:

submit/4A

Request Body

{
    "code" : "test code 11" ,
    "programTypeId" : 54 
}

About

This a try to automate codefoces submission using an endpoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages