Skip to content

Commit 4cc3ded

Browse files
committed
Test practice-b-*
1 parent 65632fe commit 4cc3ded

File tree

5 files changed

+290
-84
lines changed

5 files changed

+290
-84
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ jobs:
5757
- name: Checkout
5858
uses: actions/checkout@v1
5959

60+
- name: setup-python
61+
uses: actions/setup-python@v1
62+
with:
63+
python-version: '3.8'
64+
6065
- name: rust-toolchain
6166
uses: actions-rs/toolchain@v1
6267
with:

examples/testers/practice-b.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import itertools
2+
import random
3+
import string
4+
from argparse import ArgumentParser
5+
from subprocess import Popen, PIPE
6+
from typing import List
7+
8+
9+
def main() -> None:
10+
parser = ArgumentParser()
11+
parser.add_argument('bin')
12+
13+
binary = parser.parse_args().bin
14+
15+
for _ in range(100):
16+
judge(binary, ''.join(random.sample(string.ascii_uppercase, 26)))
17+
18+
for balls in itertools.permutations(string.ascii_uppercase[:5]):
19+
judge(binary, ''.join(balls))
20+
21+
22+
def judge(binary: str, balls: str) -> None:
23+
n = len(balls)
24+
q = 7 if n == 5 else 100
25+
26+
with Popen([binary], stdin=PIPE, stdout=PIPE) as proc:
27+
def read_words() -> List[str]:
28+
return proc.stdout.readline().decode('utf-8').split()
29+
30+
def on_query(c1: str, c2: str) -> None:
31+
reply = '<' if balls.index(c1) < balls.index(c2) else '>'
32+
proc.stdin.write(f'{reply}\n'.encode('utf-8'))
33+
proc.stdin.flush()
34+
35+
def on_answer(ans: str) -> None:
36+
if ans != balls:
37+
raise Exception('wrong answer')
38+
39+
proc.stdin.write(f'{n} {q}\n'.encode('utf-8'))
40+
proc.stdin.flush()
41+
42+
for _ in range(q):
43+
words = read_words()
44+
if len(words) == 3 and words[0] == '?':
45+
on_query(words[1], words[2])
46+
elif len(words) == 2 and words[0] == '!':
47+
return on_answer(words[1])
48+
else:
49+
raise Exception('invalid')
50+
else:
51+
words = read_words()
52+
if len(words) == 2 and words[0] == '!':
53+
return on_answer(words[1])
54+
raise Exception('answer me')
55+
56+
57+
if __name__ == '__main__':
58+
main()

test-with-generated-opts.toml

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,281 @@
11
# Dropboxからのダウンロードは行なわない。(面倒なのと誰のアカウントを使うかという問題がある)
22

3-
bin = "./target/test-with-generated-opts/bin/{}"
4-
testcases = "./target/test-with-generated-opts/testcases/{}"
3+
bin = "./target/test-with-generated-opts/bin/{problem}"
4+
testcases = "./target/test-with-generated-opts/testcases/{problem}"
55

66
[examples.abc054-c]
7+
type = "Normal"
78
name = "ABC054: C - One-stroke Path"
89
url = "https://atcoder.jp/contests/abc054/tasks/abc054_c"
910
matching = "Words"
1011
meta = { using = ["itertools", "petgraph"] }
1112

1213
[examples.abc057-b-naive]
14+
type = "Normal"
1315
name = "ABC057: B - Checkpoints"
1416
url = "https://atcoder.jp/contests/abc057/tasks/abc057_b"
1517
matching = "Words"
1618
meta = { using = [] } # 下3つと比較するため
1719

1820
[examples.abc057-b-proconio]
21+
type = "Normal"
1922
name = "ABC057: B - Checkpoints"
2023
url = "https://atcoder.jp/contests/abc057/tasks/abc057_b"
2124
matching = "Words"
2225
meta = { using = ["proconio"] }
2326

2427
[examples.abc057-b-text-io]
28+
type = "Normal"
2529
name = "ABC057: B - Checkpoints"
2630
url = "https://atcoder.jp/contests/abc057/tasks/abc057_b"
2731
matching = "Words"
2832
meta = { using = ["text_io"] }
2933

3034
[examples.abc057-b-whiteread]
35+
type = "Normal"
3136
name = "ABC057: B - Checkpoints"
3237
url = "https://atcoder.jp/contests/abc057/tasks/abc057_b"
3338
matching = "Words"
3439
meta = { using = ["whiteread"] }
3540

3641
[examples.abc073-d]
42+
type = "Normal"
3743
name = "ABC073: D - joisino's travel"
3844
url = "https://atcoder.jp/contests/abc073/tasks/abc073_d"
3945
matching = "Words"
4046
meta = { using = ["itertools", "petgraph"] }
4147

4248
[examples.abc084-d]
49+
type = "Normal"
4350
name = "ABC084: D - 2017-like Number"
4451
url = "https://atcoder.jp/contests/abc084/tasks/abc084_d"
4552
matching = "Words"
4653
meta = { using = ["itertools-num", "primal"] }
4754

4855
[examples.abc118-b-naive]
56+
type = "Normal"
4957
name = "ABC118: B - Foods Loved by Everyone"
5058
url = "https://atcoder.jp/contests/abc118/tasks/abc118_b"
5159
matching = "Words"
5260
meta = { using = [] } # 下3つと比較するため
5361

5462
[examples.abc118-b-proconio]
63+
type = "Normal"
5564
name = "ABC118: B - Foods Loved by Everyone"
5665
url = "https://atcoder.jp/contests/abc118/tasks/abc118_b"
5766
matching = "Words"
5867
meta = { using = ["proconio"] }
5968

6069
[examples.abc118-b-text-io]
70+
type = "Normal"
6171
name = "ABC118: B - Foods Loved by Everyone"
6272
url = "https://atcoder.jp/contests/abc118/tasks/abc118_b"
6373
matching = "Words"
6474
meta = { using = ["text-io"] }
6575

6676
[examples.abc118-b-whiteread]
77+
type = "Normal"
6778
name = "ABC118: B - Foods Loved by Everyone"
6879
url = "https://atcoder.jp/contests/abc118/tasks/abc118_b"
6980
matching = "Words"
7081
meta = { using = ["whiteread"] }
7182

7283
[examples.abc120-d]
84+
type = "Normal"
7385
name = "ABC120: D - Decayed Bridges"
7486
url = "https://atcoder.jp/contests/abc120/tasks/abc120_d"
7587
matching = "Words"
7688
meta = { using = ["union-find"] }
7789

7890
[examples.abc121-b-naive]
91+
type = "Normal"
7992
name = "ABC121: B - Can you solve this?"
8093
url = "https://atcoder.jp/contests/abc121/tasks/abc121_b"
8194
matching = "Words"
8295
meta = { using = [] } # 下3つと比較するため
8396

8497
[examples.abc121-b-proconio]
98+
type = "Normal"
8599
name = "ABC121: B - Can you solve this?"
86100
url = "https://atcoder.jp/contests/abc121/tasks/abc121_b"
87101
matching = "Words"
88102
meta = { using = ["proconio"] }
89103

90104
[examples.abc121-b-text-io]
105+
type = "Normal"
91106
name = "ABC121: B - Can you solve this?"
92107
url = "https://atcoder.jp/contests/abc121/tasks/abc121_b"
93108
matching = "Words"
94109
meta = { using = ["text_io"] }
95110

96111
[examples.abc121-b-whiteread]
112+
type = "Normal"
97113
name = "ABC121: B - Can you solve this?"
98114
url = "https://atcoder.jp/contests/abc121/tasks/abc121_b"
99115
matching = "Words"
100116
meta = { using = ["whiteread"] }
101117

102118
[examples.abc129-f]
119+
type = "Normal"
103120
name = "ABC129: F - Takahashi's Basics in Education and Learning"
104121
url = "https://atcoder.jp/contests/abc129/tasks/abc129_f"
105122
matching = "Words"
106123
meta = { using = ["derive_more", "ndarray", "num", "num-derive"] }
107124

108125
[examples.abc141-c]
126+
type = "Normal"
109127
name = "ABC141: C - Attack Survival"
110128
url = "https://atcoder.jp/contests/abc141/tasks/abc141_c"
111129
matching = "Words"
112130
meta = { using = ["proconio"] }
113131

114132
[examples.abc142-c]
133+
type = "Normal"
115134
name = "ABC142: C - Go to School"
116135
url = "https://atcoder.jp/contests/abc142/tasks/abc142_c"
117136
matching = "Words"
118137
meta = { using = ["itertools", "superslice"] }
119138

120139
[examples.abc142-d]
140+
type = "Normal"
121141
name = "ABC142: D - Disjoint Set of Common Divisors"
122142
url = "https://atcoder.jp/contests/abc142/tasks/abc142_d"
123143
matching = "Words"
124144
meta = { using = ["num-integer", "primal"] }
125145

126146
[examples.abc144-d]
147+
type = "Normal"
127148
name = "ABC144: D - Water Bottle"
128149
url = "https://atcoder.jp/contests/abc144/tasks/abc144_d"
129150
matching = { FloatOr = { abs = 1e-6, rel = 1e-6 } }
130151
meta = { using = ["libm"] }
131152

132153
[examples.abc150-d]
154+
type = "Normal"
133155
name = "ABC150: D - Semi Common Multiple"
134156
url = "https://atcoder.jp/contests/abc150/tasks/abc150_d"
135157
matching = "Words"
136158
meta = { using = ["itertools", "num"] }
137159

138160
[examples.abc151-d]
161+
type = "Normal"
139162
name = "ABC151: D - Maze Master"
140163
url = "https://atcoder.jp/contests/abc151/tasks/abc151_d"
141164
matching = "Words"
142165
meta = { using = ["itertools", "ndarray", "smallvec"] }
143166

144167
[examples.apg4b-a]
168+
type = "Normal"
145169
name = "APG4b: A - 1.00.はじめに"
146170
url = "https://atcoder.jp/contests/APG4b/tasks/APG4b_a"
147171
matching = "Exact"
148172
alt_testcases = [{ in = "", out = "Hello, world!\n" }]
149173
meta = { using = ["aho-corasick", "alga", "approx", "ascii", "bitset-fixed", "defmac", "derive_more", "derive-new", "either", "euclid", "fixedbitset", "getrandom", "jemallocator", "jemalloc-ctl", "if_chain", "im-rc", "indexmap", "itertools", "itertools-num", "lazy_static", "libm", "maplit", "matches", "modtype", "nalgebra", "ndarray", "nom", "num", "num-bigint", "num-complex", "num-derive", "num-integer", "num-iter", "num-rational", "num-traits", "ordered-float", "permutohedron", "petgraph", "primal", "primal-check", "primal-estimate", "primal-sieve", "proconio", "rand", "rand_chacha", "rand_core", "rand_distr", "rand_hc", "rand_pcg", "regex", "rustc-hash", "smallvec", "strsim", "superslice", "take_mut", "text_io", "union-find", "whiteread"] }
150174

151175
[examples.apg4b-ex25]
176+
type = "Normal"
152177
name = "APG4b: EX25 - 集合の操作 / 3.05"
153178
url = "https://atcoder.jp/contests/APG4b/tasks/APG4b_bx"
154179
matching = "Words"
155180
meta = { using = ["fixedbitset", "itertools"] }
156181

157182
[examples.apg4b-ex26]
183+
type = "Normal"
158184
name = "APG4b: EX26 - 電卓を作ろう3 / 3.06"
159185
url = "https://atcoder.jp/contests/APG4b/tasks/APG4b_bw"
160186
matching = "Exact"
161187
meta = { using = ["itertools", "maplit", "matches", "nom"] }
162188

163189
[examples.arc065-c]
190+
type = "Normal"
164191
name = "ABC049 / ARC065: C - 白昼夢 / Daydream"
165192
url = "https://atcoder.jp/contests/arc065/tasks/arc065_a"
166193
matching = "Words"
167194
meta = { using = ["lazy_static", "regex"] }
168195

169196
[examples.arc084-c]
197+
type = "Normal"
170198
name = "ABC077 / ARC084: C - Snuke Festival"
171199
url = "https://atcoder.jp/contests/arc084/tasks/arc084_a"
172200
matching = "Words"
173201
meta = { using = ["superslice"] }
174202

175203
[examples.atc001-b]
204+
type = "Normal"
176205
name = "ATC001: B - Union Find"
177206
url = "https://atcoder.jp/contests/atc001/tasks/unionfind_a"
178207
matching = "Words"
179208
meta = { using = ["petgraph"] }
180209

181210
[examples.atc002-b]
211+
type = "Normal"
182212
name = "ATC002: B - n^p mod m"
183213
url = "https://atcoder.jp/contests/atc002/tasks/atc002_b"
184214
matching = "Words"
185215
meta = { using = ["num"] }
186216

187217
[examples.practice-a-naive]
218+
type = "Normal"
188219
name = "practice contest: A - Welcome to AtCoder"
189220
url = "https://atcoder.jp/contests/practice/tasks/practice_1"
190221
matching = "Exact"
191222
alt_testcases = [{ in = "1\n2 3\ntest", out = "6 test\n" }, { in = "72\n128 256\nmyonmyon", out = "456 myonmyon\n" }]
192223
meta = { using = [] } # 下3つと比較するため
193224

194225
[examples.practice-a-proconio]
226+
type = "Normal"
195227
name = "practice contest: A - Welcome to AtCoder"
196228
url = "https://atcoder.jp/contests/practice/tasks/practice_1"
197229
matching = "Exact"
198230
alt_testcases = [{ in = "1\n2 3\ntest", out = "6 test\n" }, { in = "72\n128 256\nmyonmyon", out = "456 myonmyon\n" }]
199231
meta = { using = ["proconio"] }
200232

201233
[examples.practice-a-text-io]
234+
type = "Normal"
202235
name = "practice contest: A - Welcome to AtCoder"
203236
url = "https://atcoder.jp/contests/practice/tasks/practice_1"
204237
matching = "Exact"
205238
alt_testcases = [{ in = "1\n2 3\ntest", out = "6 test\n" }, { in = "72\n128 256\nmyonmyon", out = "456 myonmyon\n" }]
206239
meta = { using = ["text-io"] }
207240

208241
[examples.practice-a-whiteread]
242+
type = "Normal"
209243
name = "practice contest: A - Welcome to AtCoder"
210244
url = "https://atcoder.jp/contests/practice/tasks/practice_1"
211245
matching = "Exact"
212246
alt_testcases = [{ in = "1\n2 3\ntest", out = "6 test\n" }, { in = "72\n128 256\nmyonmyon", out = "456 myonmyon\n" }]
213247
meta = { using = ["whiteread"] }
214248

215-
# [examples.practice-b-naive]
216-
# name = "practice contest: B - Interactive Sorting"
217-
# url = "https://atcoder.jp/contests/practice/tasks/practice_2"
218-
# meta = { using = ["itertools"] }
219-
#
220-
# [examples.practice-b-proconio]
221-
# name = "practice contest: B - Interactive Sorting"
222-
# url = "https://atcoder.jp/contests/practice/tasks/practice_2"
223-
# meta = { using = ["itertools", "proconio"] }
224-
#
225-
# [examples.practice-b-text-io]
226-
# name = "practice contest: B - Interactive Sorting"
227-
# url = "https://atcoder.jp/contests/practice/tasks/practice_2"
228-
# meta = { using = ["itertools", "text-io"] }
229-
#
230-
# [examples.practice-b-whiteread]
231-
# name = "practice contest: B - Interactive Sorting"
232-
# url = "https://atcoder.jp/contests/practice/tasks/practice_2"
233-
# meta = { using = ["itertools", "whiteread"] }
249+
[examples.practice-b-naive]
250+
type = "Special"
251+
name = "practice contest: B - Interactive Sorting"
252+
url = "https://atcoder.jp/contests/practice/tasks/practice_2"
253+
tester = ["python", "./examples/testers/practice-b.py", "{bin}"]
254+
meta = { using = ["itertools", "maplit"] }
255+
256+
[examples.practice-b-proconio]
257+
type = "Special"
258+
name = "practice contest: B - Interactive Sorting"
259+
url = "https://atcoder.jp/contests/practice/tasks/practice_2"
260+
tester = ["python", "./examples/testers/practice-b.py", "{bin}"]
261+
meta = { using = ["itertools", "maplit", "proconio"] }
262+
263+
[examples.practice-b-text-io]
264+
type = "Special"
265+
name = "practice contest: B - Interactive Sorting"
266+
url = "https://atcoder.jp/contests/practice/tasks/practice_2"
267+
tester = ["python", "./examples/testers/practice-b.py", "{bin}"]
268+
meta = { using = ["itertools", "maplit", "text-io"] }
269+
270+
[examples.practice-b-whiteread]
271+
type = "Special"
272+
name = "practice contest: B - Interactive Sorting"
273+
url = "https://atcoder.jp/contests/practice/tasks/practice_2"
274+
tester = ["python", "./examples/testers/practice-b.py", "{bin}"]
275+
meta = { using = ["itertools", "maplit", "whiteread"] }
234276

235277
[examples.sumitrust2019-c]
278+
type = "Normal"
236279
name = "Sumitomo Mitsui Trust Bank Programming Contest 2019: C - 100 to 105"
237280
url = "https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_c"
238281
matching = "Words"

0 commit comments

Comments
 (0)