Skip to content

Commit

Permalink
Use shared configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
metopa committed Mar 21, 2018
1 parent 706ca84 commit 39370f8
Show file tree
Hide file tree
Showing 656 changed files with 1,957 additions and 5,115 deletions.
2 changes: 1 addition & 1 deletion epi_judge_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ add_executable(kth_node_in_tree kth_node_in_tree.cc)
add_executable(largest_rectangle_under_skyline largest_rectangle_under_skyline.cc)
add_executable(left_right_justify_text left_right_justify_text.cc)
add_executable(levenshtein_distance levenshtein_distance.cc)
add_executable(line_though_most_points line_though_most_points.cc)
add_executable(line_through_most_points line_through_most_points.cc)
add_executable(list_cyclic_right_shift list_cyclic_right_shift.cc)
add_executable(longest_contained_interval longest_contained_interval.cc)
add_executable(longest_increasing_subarray longest_increasing_subarray.cc)
Expand Down
14 changes: 7 additions & 7 deletions epi_judge_cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1328,19 +1328,19 @@ levenshtein_distance_dbg: $(BUILD_DIR)/levenshtein_distance_dbg
.PHONY: levenshtein_distance levenshtein_distance_dbg


# line_though_most_points.cc
# line_through_most_points.cc

$(BUILD_DIR)/line_though_most_points: $(SRC_DIR)/line_though_most_points.cc | $(BUILD_DIR)
$(BUILD_DIR)/line_through_most_points: $(SRC_DIR)/line_through_most_points.cc | $(BUILD_DIR)
$(CXX_COMPILER) $(CXX_FLAGS_RELEASE) -o $@ $<
line_though_most_points: $(BUILD_DIR)/line_though_most_points
line_through_most_points: $(BUILD_DIR)/line_through_most_points
$< $(PROGRAM_ARGS)

$(BUILD_DIR)/line_though_most_points_dbg: $(SRC_DIR)/line_though_most_points.cc | $(BUILD_DIR)
$(BUILD_DIR)/line_through_most_points_dbg: $(SRC_DIR)/line_through_most_points.cc | $(BUILD_DIR)
$(CXX_COMPILER) $(CXX_FLAGS_DEBUG) -o $@ $<
line_though_most_points_dbg: $(BUILD_DIR)/line_though_most_points_dbg
line_through_most_points_dbg: $(BUILD_DIR)/line_through_most_points_dbg
$< $(PROGRAM_ARGS)

.PHONY: line_though_most_points line_though_most_points_dbg
.PHONY: line_through_most_points line_through_most_points_dbg


# list_cyclic_right_shift.cc
Expand Down Expand Up @@ -3275,7 +3275,7 @@ all: \
$(BUILD_DIR)/largest_rectangle_under_skyline \
$(BUILD_DIR)/left_right_justify_text \
$(BUILD_DIR)/levenshtein_distance \
$(BUILD_DIR)/line_though_most_points \
$(BUILD_DIR)/line_through_most_points \
$(BUILD_DIR)/list_cyclic_right_shift \
$(BUILD_DIR)/longest_contained_interval \
$(BUILD_DIR)/longest_increasing_subarray \
Expand Down
10 changes: 2 additions & 8 deletions epi_judge_cpp/a_b_sqrt2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ vector<double> GenerateFirstKABSqrt2(int k) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"k"};
return GenericTestMain(args, timeout_seconds, "a_b_sqrt2.tsv",
&GenerateFirstKABSqrt2, DefaultComparator{},
param_names);
return GenericTestMain(args, "a_b_sqrt2.tsv", &GenerateFirstKABSqrt2,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/absent_value_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ int FindMissingElementWrapper(const vector<int>& stream) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"stream"};
return GenericTestMain(args, timeout_seconds, "absent_value_array.tsv",
return GenericTestMain(args, "absent_value_array.tsv",
&FindMissingElementWrapper, DefaultComparator{},
param_names);
}
10 changes: 2 additions & 8 deletions epi_judge_cpp/adding_credits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,8 @@ void ClientsCreditsInfoTester(const std::vector<Operation>& ops) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"ops"};
return GenericTestMain(args, timeout_seconds, "adding_credits.tsv",
&ClientsCreditsInfoTester, DefaultComparator{},
param_names);
return GenericTestMain(args, "adding_credits.tsv", &ClientsCreditsInfoTester,
DefaultComparator{}, param_names);
}
9 changes: 2 additions & 7 deletions epi_judge_cpp/advance_by_offsets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ bool CanReachEnd(const vector<int>& max_advance_steps) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"max_advance_steps"};
return GenericTestMain(args, timeout_seconds, "advance_by_offsets.tsv",
&CanReachEnd, DefaultComparator{}, param_names);
return GenericTestMain(args, "advance_by_offsets.tsv", &CanReachEnd,
DefaultComparator{}, param_names);
}
9 changes: 2 additions & 7 deletions epi_judge_cpp/alternating_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,8 @@ void RearrangeWrapper(TimedExecutor& executor, vector<int> A) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"executor", "A"};
return GenericTestMain(args, timeout_seconds, "alternating_array.tsv",
&RearrangeWrapper, DefaultComparator{}, param_names);
return GenericTestMain(args, "alternating_array.tsv", &RearrangeWrapper,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/anagrams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ vector<vector<string>> FindAnagrams(const vector<string>& dictionary) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"dictionary"};
return GenericTestMain(
args, timeout_seconds, "anagrams.tsv", &FindAnagrams,
args, "anagrams.tsv", &FindAnagrams,
&UnorderedComparator<std::vector<std::vector<std::string>>>, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/apply_permutation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ vector<int> ApplyPermutationWrapper(vector<int> perm, vector<int> A) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"perm", "A"};
return GenericTestMain(args, timeout_seconds, "apply_permutation.tsv",
return GenericTestMain(args, "apply_permutation.tsv",
&ApplyPermutationWrapper, DefaultComparator{},
param_names);
}
9 changes: 2 additions & 7 deletions epi_judge_cpp/arbitrage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ bool IsArbitrageExist(vector<vector<double>> graph) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"graph"};
return GenericTestMain(args, timeout_seconds, "arbitrage.tsv",
&IsArbitrageExist, DefaultComparator{}, param_names);
return GenericTestMain(args, "arbitrage.tsv", &IsArbitrageExist,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/binomial_coefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ int ComputeBinomialCoefficient(int n, int k) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"n", "k"};
return GenericTestMain(args, timeout_seconds, "binomial_coefficients.tsv",
return GenericTestMain(args, "binomial_coefficients.tsv",
&ComputeBinomialCoefficient, DefaultComparator{},
param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/bonus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ int CalculateBonus(const vector<int>& productivity) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"productivity"};
return GenericTestMain(args, timeout_seconds, "bonus.tsv", &CalculateBonus,
return GenericTestMain(args, "bonus.tsv", &CalculateBonus,
DefaultComparator{}, param_names);
}
10 changes: 2 additions & 8 deletions epi_judge_cpp/bst_from_preorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ unique_ptr<BstNode<int>> RebuildBSTFromPreorder(
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"preorder_sequence"};
return GenericTestMain(args, timeout_seconds, "bst_from_preorder.tsv",
&RebuildBSTFromPreorder, DefaultComparator{},
param_names);
return GenericTestMain(args, "bst_from_preorder.tsv", &RebuildBSTFromPreorder,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/bst_from_sorted_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@ int BuildMinHeightBSTFromSortedArrayWrapper(TimedExecutor& executor,
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"executor", "A"};
return GenericTestMain(args, timeout_seconds, "bst_from_sorted_array.tsv",
return GenericTestMain(args, "bst_from_sorted_array.tsv",
&BuildMinHeightBSTFromSortedArrayWrapper,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/bst_merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ shared_ptr<BstNode<int>> MergeTwoBSTs(shared_ptr<BstNode<int>> A,
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"A", "B"};
return GenericTestMain(args, timeout_seconds, "bst_merge.tsv", &MergeTwoBSTs,
return GenericTestMain(args, "bst_merge.tsv", &MergeTwoBSTs,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/bst_to_sorted_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ std::vector<int> BSTToDoublyLinkedListWrapper(
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"executor", "tree"};
return GenericTestMain(args, timeout_seconds, "bst_to_sorted_list.tsv",
return GenericTestMain(args, "bst_to_sorted_list.tsv",
&BSTToDoublyLinkedListWrapper, DefaultComparator{},
param_names);
}
10 changes: 2 additions & 8 deletions epi_judge_cpp/buy_and_sell_stock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ double BuyAndSellStockOnce(const vector<double>& prices) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"prices"};
return GenericTestMain(args, timeout_seconds, "buy_and_sell_stock.tsv",
&BuyAndSellStockOnce, DefaultComparator{},
param_names);
return GenericTestMain(args, "buy_and_sell_stock.tsv", &BuyAndSellStockOnce,
DefaultComparator{}, param_names);
}
11 changes: 3 additions & 8 deletions epi_judge_cpp/buy_and_sell_stock_k_times.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ double BuyAndSellStockKTimes(const vector<double>& prices, int k) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"prices", "k"};
return GenericTestMain(
args, timeout_seconds, "buy_and_sell_stock_k_times.tsv",
&BuyAndSellStockKTimes, DefaultComparator{}, param_names);
return GenericTestMain(args, "buy_and_sell_stock_k_times.tsv",
&BuyAndSellStockKTimes, DefaultComparator{},
param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/buy_and_sell_stock_twice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ double BuyAndSellStockTwice(const vector<double>& prices) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"prices"};
return GenericTestMain(args, timeout_seconds, "buy_and_sell_stock_twice.tsv",
return GenericTestMain(args, "buy_and_sell_stock_twice.tsv",
&BuyAndSellStockTwice, DefaultComparator{},
param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/calendar_rendering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ template <>
struct SerializationTraits<Event> : UserSerTraits<Event, int, int> {};

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"A"};
return GenericTestMain(args, timeout_seconds, "calendar_rendering.tsv",
return GenericTestMain(args, "calendar_rendering.tsv",
&FindMaxSimultaneousEvents, DefaultComparator{},
param_names);
}
9 changes: 2 additions & 7 deletions epi_judge_cpp/circular_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ void QueueTester(const std::vector<QueueOp>& ops) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"ops"};
return GenericTestMain(args, timeout_seconds, "circular_queue.tsv",
&QueueTester, DefaultComparator{}, param_names);
return GenericTestMain(args, "circular_queue.tsv", &QueueTester,
DefaultComparator{}, param_names);
}
7 changes: 1 addition & 6 deletions epi_judge_cpp/closest_int_same_weight.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ unsigned long long ClosestIntSameBitCount(unsigned long long x) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"x"};
return GenericTestMain(args, timeout_seconds, "closest_int_same_weight.tsv",
return GenericTestMain(args, "closest_int_same_weight.tsv",
&ClosestIntSameBitCount, DefaultComparator{},
param_names);
}
10 changes: 2 additions & 8 deletions epi_judge_cpp/collatz_checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ bool TestCollatzConjecture(int n) {
}

int main(int argc, char* argv[]) {
// The timeout is set to 15 seconds for each test case.
// If your program ends with TIMEOUT error, and you want to try longer time
// limit, you can extend the limit by changing the following line.
std::chrono::seconds timeout_seconds{15};

std::vector<std::string> args{argv + 1, argv + argc};
std::vector<std::string> param_names{"n"};
return GenericTestMain(args, timeout_seconds, "collatz_checker.tsv",
&TestCollatzConjecture, DefaultComparator{},
param_names);
return GenericTestMain(args, "collatz_checker.tsv", &TestCollatzConjecture,
DefaultComparator{}, param_names);
}
Loading

0 comments on commit 39370f8

Please sign in to comment.