-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement BeforeOutputFormat() (#121)
Resolves #38
- Loading branch information
Showing
9 changed files
with
165 additions
and
1 deletion.
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
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
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,7 @@ | ||
#include <cstdio> | ||
|
||
int main() { | ||
printf("even\n"); | ||
printf("odd\n"); | ||
printf("even\n"); | ||
} |
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,64 @@ | ||
#include <bits/stdc++.h> | ||
#include <tcframe/spec.hpp> | ||
|
||
using namespace std; | ||
using namespace tcframe; | ||
|
||
class ProblemSpec : public BaseProblemSpec { | ||
protected: | ||
int N; | ||
vector<int> A; | ||
|
||
int positive_count; | ||
vector<string> answers; | ||
|
||
void InputFormat() { | ||
LINE(N); | ||
LINE(A % SIZE(N)); | ||
} | ||
|
||
void BeforeOutputFormat() { | ||
positive_count = count_if(A.begin(), A.end(), [](int a) {return a > 0;}); | ||
} | ||
|
||
void OutputFormat() { | ||
LINES(answers) % SIZE(positive_count); | ||
} | ||
|
||
void GradingConfig() { | ||
TimeLimit(2); | ||
MemoryLimit(64); | ||
} | ||
|
||
void Constraints() { | ||
CONS(1 <= N && N <= 10); | ||
} | ||
}; | ||
|
||
class TestSpec : public BaseTestSpec<ProblemSpec> { | ||
protected: | ||
void BeforeTestCase() { | ||
A.clear(); | ||
} | ||
|
||
void AfterTestCase() { | ||
N++; | ||
A.push_back(-100); | ||
} | ||
|
||
void SampleTestCase1() { | ||
Input({ | ||
"5", | ||
"4 -1 3 2 -5", | ||
}); | ||
Output({ | ||
"even", | ||
"odd", | ||
"even" | ||
}); | ||
} | ||
|
||
void TestCases() { | ||
CASE(N = 6, A = {-1, 2, 3, -4, -5, 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
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