-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only batch is supported. Also, NoOutput() must be accompanied with CustomScorer().
- Loading branch information
Showing
19 changed files
with
301 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ class ProblemSpec : public BaseProblemSpec { | |
} | ||
|
||
void StyleConfig() { | ||
CustomScorer(); | ||
NoOutput(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) { | ||
ifstream tc_in(argv[1]); | ||
ifstream tc_out(argv[2]); | ||
ifstream con_out(argv[3]); | ||
|
||
int A, B; | ||
tc_in >> A >> B; | ||
|
||
double tc_answer; | ||
tc_out >> tc_answer; | ||
|
||
double con_answer; | ||
con_out >> con_answer; | ||
|
||
if (B == 4) { | ||
return 1 / (B - 4); | ||
} else if (abs(tc_answer - con_answer) < 1e-1) { | ||
cout << "AC" << endl; | ||
} else { | ||
cout << "WA" << endl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <cstdio> | ||
|
||
int A, B; | ||
|
||
int main() { | ||
scanf("%d %d", &A, &B); | ||
printf("%.0lf\n", (double)(A + B)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <cstdio> | ||
|
||
int A, B; | ||
|
||
int main() { | ||
scanf("%d %d", &A, &B); | ||
if (B == 3) { | ||
// WA | ||
printf("%.2lf\n", A + B + 0.2); | ||
} else { | ||
// AC | ||
printf("%.2lf\n", A + B + 0.02); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <tcframe/spec.hpp> | ||
|
||
using namespace tcframe; | ||
|
||
class ProblemSpec : public BaseProblemSpec { | ||
protected: | ||
int A, B; | ||
double res; | ||
|
||
void InputFormat() { | ||
LINE(A, B); | ||
} | ||
|
||
void StyleConfig() { | ||
CustomScorer(); | ||
} | ||
|
||
void GradingConfig() { | ||
TimeLimit(2); | ||
MemoryLimit(64); | ||
} | ||
|
||
void Constraints() { | ||
CONS(1 <= A && A <= 10); | ||
CONS(1 <= B && B <= 10); | ||
} | ||
}; | ||
|
||
class TestSpec : public BaseTestSpec<ProblemSpec> { | ||
protected: | ||
void SampleTestCase1() { | ||
Input({ | ||
"1 5" | ||
}); | ||
Output({ | ||
"6.09" | ||
}); | ||
} | ||
|
||
void TestCases() { | ||
CASE(A = 1, B = 3); | ||
CASE(A = 2, B = 4); | ||
CASE(A = 5, B = 6); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ class ProblemSpec : public BaseProblemSpec { | |
} | ||
|
||
void StyleConfig() { | ||
CustomScorer(); | ||
NoOutput(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
export TCFRAME_HOME=../../tcframe | ||
|
||
g++ -o solution solution.cpp | ||
g++ -o scorer scorer.cpp | ||
$TCFRAME_HOME/scripts/tcframe build | ||
./runner --solution=./solution --scorer=./scorer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
export TCFRAME_HOME=../../tcframe | ||
|
||
g++ -o solution_alt solution_alt.cpp | ||
g++ -o scorer scorer.cpp | ||
./runner grade --solution=./solution_alt --scorer=./scorer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
#include "tcframe/grading_style/GradingStyle.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "tcframe/evaluator.hpp" | ||
#include "tcframe/os.hpp" | ||
#include "tcframe/scorer.hpp" | ||
#include "tcframe/util.hpp" | ||
|
||
using std::string; | ||
|
||
namespace tcframe { | ||
|
||
struct GradingStyle { | ||
private: | ||
Evaluator* evaluator_; | ||
Scorer* scorer_; | ||
|
||
public: | ||
GradingStyle(Evaluator* evaluator, Scorer* scorer) | ||
: evaluator_(evaluator) | ||
, scorer_(scorer) {} | ||
|
||
Evaluator* evaluator() const { | ||
return evaluator_; | ||
} | ||
|
||
Scorer* scorer() const { | ||
return scorer_; | ||
} | ||
}; | ||
|
||
class GradingStyleFactory { | ||
public: | ||
virtual ~GradingStyleFactory() {} | ||
|
||
virtual GradingStyle createBatch(OperatingSystem* os, const optional<string>& scorerCommand) { | ||
Evaluator* evaluator = new BatchEvaluator(os); | ||
|
||
Scorer* scorer; | ||
if (scorerCommand) { | ||
scorer = new CustomScorer(os, scorerCommand.value()); | ||
} else { | ||
scorer = new DiffScorer(os); | ||
} | ||
|
||
return GradingStyle(evaluator, scorer); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.