Expand description
§Examples:
- Print list of people with highest number of fastest solutions
//make a client
let client = Client::new(String::from("Gemmady"));
let task_list = client.get_task_list(0, 1024, "", None, None).unwrap();
let mut hm = std::collections::HashMap::<String, u32>::new();
for i in task_list.tasks {
let best = client.get_stats(&i.name).unwrap().best;
if best.len() > 0 {
let t = hm.entry(best[0].username.clone()).or_insert(0);
*t += 1;
}
}
let mut v: Vec<(u32, String)> = hm.iter().map(|x| (*x.1, x.0.clone())).collect();
v.sort();
for i in v.iter().rev() {
println!("{} {}", i.1, i.0);
}
- Resubmit all fastest solutions
let username = String::from("user");
let password = "password";
let mut client = Client::new(username.clone());
client.login(password).unwrap();
let user = client.get_user(&username).unwrap();
for sc in user.scores.unwrap() {
if sc.score == 100.0 {
println!("{} has score 100", sc.title);
let sub_list = client.get_submission_list(&sc.name).unwrap();
let best_sub = sub_list.get_fastest_high(&client).unwrap();
let files = &best_sub.files;
if files.len() == 1 { // if it is not an output-only
let mut submitted: bool = false;
print!("Resubmitting {}", sc.name.clone());
while !submitted { // because cmsocial has a limit to submission rate
print!(".");
if client
.submit_normal(
&sc.name,
&client.get_file(&files[0]).unwrap(),
files[0].name.split(".").collect::<Vec<&str>>().last().unwrap(),
)
.is_ok()
{
submitted = true;
}
}
println!("");
}
}
}
§Not implemented yet:
- submission for output-only problems example
- test submission request example is
invia
button at the bottom, also that button does not have english localization - admin requests (this)
- any request I do not know the existence of
Structs§
- Check
Response - Response for email and username checking
- Client
- Client you will do almost everything with
- Detailed
Submission - Details of a specific submission
- Detailed
Task - Detailed task description
- File
- Description of a file
- Institute
- Institute of an user
- Question
- Question inside of a test
- Recover
Response - Responses for password recovery requests
- Region
- Region
- Region
List - List of regions
- Score
- Score achieved on a certain task by someone
- Score
Detail - Score details for a specific submission
- Stat
- Best time by someone on some task
- Statement
- digest of statement file? apparently not
- Stats
- Stats of a certain task
- Submission
- Submission, not detailed
- Submission
List - List of submissions by a user for a task
- Tag
- tags, like technique or event tags
- Task
- Task in a TaskList
- Task
List - List of tasks
- Technique
List - List of
technique
tags - Test
- Test, also known as Quiz
- Test
Head - Basic informations of a test
- Test
List - List of Tests
- Testcase
- Outcome of a certain submission for a specific testcase
- User
- User info
- User
List - List of users