Skip to content

Commit

Permalink
Merge pull request yosupo06#1178 from yosupo06/refactor/823
Browse files Browse the repository at this point in the history
stop using wrong = True and introduce expect
  • Loading branch information
yosupo06 authored Jun 4, 2024
2 parents 9479ae3 + 4d73581 commit b1346b8
Show file tree
Hide file tree
Showing 104 changed files with 129 additions and 153 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"extensions": [
"llvm-vs-code-extensions.vscode-clangd",
"ms-python.python",
"github.vscode-github-actions"
"github.vscode-github-actions",
"tamasfe.even-better-toml"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions datastructure/deque_operate_all_composite/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/815"

[[solutions]]
name = "bbst.cpp"
wrong = false

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"
4 changes: 2 additions & 2 deletions datastructure/double_ended_priority_queue/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/874"
[[solutions]]
name = "double_priority_queue.cpp"
allow_tle = false
wrong = false


[[solutions]]
name = "multiset.cpp"
allow_tle = false
wrong = false


[params]
N_MIN = 0
Expand Down
14 changes: 7 additions & 7 deletions datastructure/dynamic_graph_vertex_add_component_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/347"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"


[params]
N_AND_Q_MIN = 1
N_AND_Q_MAX = 300_000
N_AND_Q_SMALL_MAX = 1_000
A_AND_X_MIN = 0
A_AND_X_MAX = 1_000_000_000
N_AND_Q_MIN = 1
N_AND_Q_MAX = 300_000
N_AND_Q_SMALL_MAX = 1_000
A_AND_X_MIN = 0
A_AND_X_MAX = 1_000_000_000
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/242"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 500_000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/521"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_MAX = 200_000
Expand Down
2 changes: 1 addition & 1 deletion datastructure/dynamic_tree_vertex_add_path_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/223"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"

[params]
N_AND_Q_MIN = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/229"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"

[params]
N_AND_Q_MIN = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/307"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"

[params]
N_AND_Q_MIN = 1
Expand Down
2 changes: 1 addition & 1 deletion datastructure/line_add_get_min/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/174"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MIN = 1
Expand Down
3 changes: 1 addition & 2 deletions datastructure/number_of_subsequences/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ forum = 'https://github.com/yosupo06/library-checker-problems/issues/811'
name = "correct2.cpp"
[[solutions]]
name = "naive.cpp"
allow_tle = true
wrong = true
expect = "WA"

[params]
N_MIN = 1
Expand Down
4 changes: 2 additions & 2 deletions datastructure/persistent_queue/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/379"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"
[[solutions]]
name = "two_stacks.cpp"
wrong = true
expect = "TLE"

[params]
Q_MIN = 1
Expand Down
4 changes: 2 additions & 2 deletions datastructure/persistent_unionfind/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/405"

[[solutions]]
name = "correct_2.cpp"
wrong = false

[[solutions]]
name = "conchon_filliatre.cpp"
wrong = true
expect = "TLE"

[params]
MAX_N = 200_000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/818"

[[solutions]]
name = "naive.cpp"
wrong = false
allow_tle = true

[params]
Expand Down
2 changes: 0 additions & 2 deletions datastructure/predecessor_problem/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/632"

[[solutions]]
name = "fenwick.cpp"
wrong = false
allow_tle = true

[[solutions]]
name = "set.cpp"
wrong = false
allow_tle = true

[params]
Expand Down
2 changes: 1 addition & 1 deletion datastructure/queue_operate_all_composite/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/208"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"
2 changes: 1 addition & 1 deletion datastructure/range_affine_point_get/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/778"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 500_000
Expand Down
2 changes: 1 addition & 1 deletion datastructure/range_affine_range_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/233"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 500_000
Expand Down
2 changes: 1 addition & 1 deletion datastructure/range_chmin_chmax_add_range_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/243"
name = "correct_with_assert.cpp"
[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 200_000
Expand Down
2 changes: 1 addition & 1 deletion datastructure/range_kth_smallest/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/310"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"

[params]
N_MIN = 1
Expand Down
1 change: 0 additions & 1 deletion datastructure/range_reverse_range_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/538"

[[solutions]]
name = "naive.cpp"
wrong = false
allow_tle = true

[params]
Expand Down
2 changes: 1 addition & 1 deletion datastructure/rectangle_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/118"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"
2 changes: 1 addition & 1 deletion datastructure/segment_add_get_min/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/211"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MIN = 1
Expand Down
2 changes: 1 addition & 1 deletion datastructure/static_range_count_distinct/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/770"

[[solutions]]
name = "naive.cpp"
wrong = false

allow_tle = true

[params]
Expand Down
2 changes: 1 addition & 1 deletion datastructure/static_range_inversions_query/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/563"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_MIN = 1
Expand Down
2 changes: 1 addition & 1 deletion datastructure/static_range_mode_query/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/959"

[[solutions]]
name = "naive.cpp"
wrong = false

allow_tle = true

[params]
Expand Down
2 changes: 1 addition & 1 deletion datastructure/static_range_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/398"

[[solutions]]
name = "wa.cpp"
wrong = true
expect = "WA"

[params]
MAX_N = 500_000
Expand Down
2 changes: 0 additions & 2 deletions datastructure/static_rectangle_add_rectangle_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/771"

[[solutions]]
name = "tle_1.cpp"
wrong = false
allow_tle = true

[[solutions]]
name = "tle_2.cpp"
wrong = false
allow_tle = true


Expand Down
2 changes: 1 addition & 1 deletion datastructure/vertex_add_path_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/125"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 500_000
Expand Down
2 changes: 1 addition & 1 deletion datastructure/vertex_add_subtree_sum/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/167"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"
2 changes: 1 addition & 1 deletion datastructure/vertex_set_path_composite/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/190"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "RE"

[params]
N_AND_Q_MAX = 200_000
Expand Down
23 changes: 12 additions & 11 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def judge(self, src: Path, config: dict):
_tmpdir = TemporaryDirectory()
tmpdir = _tmpdir.name
checker = self.checker
results = set()
results: set[str] = set()

logger.info('Start {}'.format(src.name))

Expand Down Expand Up @@ -436,23 +436,24 @@ def judge(self, src: Path, config: dict):
'{} : {}'.format(case, checker_output.decode('utf-8')))

_tmpdir.cleanup()
allow_status = set()
expect_status: str = config.get('expect', '') # type: ignore
allow_status: set[str] = set()
if expect_status != "":
allow_status.add(expect_status)
allow_status.add('AC')
if config.get('wrong', False):
allow_status.update(['WA', 'RE', 'TLE'])
if config.get('allow_tle', False):
allow_status.add('TLE')
if config.get('allow_wa', False):
allow_status.add('WA')
if config.get('allow_re', False):
allow_status.add('RE')
if config.get('allow_tle', False):
allow_status.add('TLE')

if len(results - allow_status) != 0:
logger.error('unexpected status was appeared: {} (allowed {})'.format(
results, allow_status))

if config.get('wrong', False):
if results == {'AC'}:
logger.error('wrong solution got accept: {}'.format(src))
exit(1)
if expect_status != '' and expect_status not in results:
logger.error('expected status {} was not appeared: {}'.format(
expect_status, results))

def calc_hashes(self) -> MutableMapping[str, str]:
hashes: MutableMapping[str, str] = dict()
Expand Down
2 changes: 1 addition & 1 deletion geo/sort_points_by_argument/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/248"

[[solutions]]
name = "wa.cpp"
wrong = true
expect = "WA"


[params]
Expand Down
2 changes: 1 addition & 1 deletion graph/assignment/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/38"

[[solutions]]
name = 'invalid.cpp'
wrong = true
expect = "WA"

[params]
N_MIN = 1
Expand Down
2 changes: 1 addition & 1 deletion graph/cartesian_tree/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/554"

[[solutions]]
name = "naive.cpp"
wrong = true
expect = "TLE"

[params]
N_MIN = 1
Expand Down
8 changes: 4 additions & 4 deletions graph/chordal_graph_recognition/info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ forum = "https://github.com/yosupo06/library-checker-problems/issues/591"
number = 5
[[solutions]]
name = "bfs.cpp"
wrong = true
expect = "RE"
[[solutions]]
name = "dfs.cpp"
wrong = true
expect = "RE"
[[solutions]]
name = "mcs_wa1.cpp"
wrong = true
expect = "WA"
[[solutions]]
name = "mcs_wa2.cpp"
wrong = true
expect = "WA"

[params]
N_MIN = 1
Expand Down
Loading

0 comments on commit b1346b8

Please sign in to comment.