Skip to content

Instantly share code, notes, and snippets.

@pzread pzread/check.cpp
Last active Jul 1, 2016

Embed
What would you like to do?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
char str[100];
char ans[100];
FILE *ansf = fdopen(2, "r");
while(fgets(str, sizeof(str), stdin) != NULL) {
if(fgets(ans, sizeof(ans), ansf) == NULL) {
return -1;
}
if(strcmp(str, ans)) {
return -1;
}
}
if(fgets(ans, sizeof(ans), ansf) != NULL) {
return -1;
}
return 0;
}
{
"test": [{
"memlimit": 268435456,
"metadata": {
"data": [0]
},
"timelimit": 10000,
"test_idx": 0
}],
"metadata": {
"redir_test": {
"pipeout": 1,
"testin": 0,
"testout": -1,
"pipein": -1
},
"redir_check": {
"ansin": 2,
"testin": -1,
"pipeout": 0,
"pipein": -1
}
},
"res_path": "res",
"comp_type": "g++",
"check_type": "ioredir",
"code_path": "test.cpp",
"chal_id": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.