Example #1
0
// Just run code used here. if stdin is nil, then sample input is used
func Exec(pid int, rawCode string, lang string, stdin string) Bridge.Code {
	code := Bridge.Code{Lang: lang, Stdin: stdin}
	cr := Bridge.CRManager{Program: &code, RawCode: &rawCode}
	if stdin == "" {
		problem := new(Problem)
		problem.Pid = pid
		if err := problem.GetSampleIOByPid(); err != true {
			return Bridge.Code{}
		}
		code.Stdin = problem.Sample_input
		Bridge.CompileExec(&cr)
		if code.Stdout != problem.Sample_output {
			code.RunStatus = false
		}
	} else {
		Bridge.CompileExec(&cr)
	}
	return code
}