From 9e86128cf24f6b543e6bac0c442a33ff38c030c2 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 30 Mar 2023 16:48:39 +0800 Subject: [PATCH] =?UTF-8?q?#1991.=20=E3=80=90=E6=A8=A1=E6=9D=BF=E3=80=91?= =?UTF-8?q?=E7=BC=A9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/74866 --- S2OJ/1991/1991.cpp | 114 ++++++++++++++++++++++++++++++++++++ S2OJ/1991/data/1.in | 3 + S2OJ/1991/data/1.out | 3 + S2OJ/1991/data/10.in | 3 + S2OJ/1991/data/10.out | 3 + S2OJ/1991/data/11.in | 3 + S2OJ/1991/data/11.out | 3 + S2OJ/1991/data/12.in | 3 + S2OJ/1991/data/12.out | 3 + S2OJ/1991/data/13.in | 3 + S2OJ/1991/data/13.out | 3 + S2OJ/1991/data/14.in | 3 + S2OJ/1991/data/14.out | 3 + S2OJ/1991/data/15.in | 3 + S2OJ/1991/data/15.out | 3 + S2OJ/1991/data/16.in | 3 + S2OJ/1991/data/16.out | 3 + S2OJ/1991/data/17.in | 3 + S2OJ/1991/data/17.out | 3 + S2OJ/1991/data/18.in | 3 + S2OJ/1991/data/18.out | 3 + S2OJ/1991/data/19.in | 3 + S2OJ/1991/data/19.out | 3 + S2OJ/1991/data/2.in | 3 + S2OJ/1991/data/2.out | 3 + S2OJ/1991/data/20.in | 3 + S2OJ/1991/data/20.out | 3 + S2OJ/1991/data/3.in | 3 + S2OJ/1991/data/3.out | 3 + S2OJ/1991/data/4.in | 3 + S2OJ/1991/data/4.out | 3 + S2OJ/1991/data/5.in | 3 + S2OJ/1991/data/5.out | 3 + S2OJ/1991/data/6.in | 3 + S2OJ/1991/data/6.out | 3 + S2OJ/1991/data/7.in | 3 + S2OJ/1991/data/7.out | 3 + S2OJ/1991/data/8.in | 3 + S2OJ/1991/data/8.out | 3 + S2OJ/1991/data/9.in | 3 + S2OJ/1991/data/9.out | 3 + S2OJ/1991/data/problem.conf | 3 + S2OJ/1991/data/std.cpp | 3 + S2OJ/1991/data/val.cpp | 3 + S2OJ/1991/resources/gen.cpp | 57 ++++++++++++++++++ 45 files changed, 300 insertions(+) create mode 100644 S2OJ/1991/1991.cpp create mode 100644 S2OJ/1991/data/1.in create mode 100644 S2OJ/1991/data/1.out create mode 100644 S2OJ/1991/data/10.in create mode 100644 S2OJ/1991/data/10.out create mode 100644 S2OJ/1991/data/11.in create mode 100644 S2OJ/1991/data/11.out create mode 100644 S2OJ/1991/data/12.in create mode 100644 S2OJ/1991/data/12.out create mode 100644 S2OJ/1991/data/13.in create mode 100644 S2OJ/1991/data/13.out create mode 100644 S2OJ/1991/data/14.in create mode 100644 S2OJ/1991/data/14.out create mode 100644 S2OJ/1991/data/15.in create mode 100644 S2OJ/1991/data/15.out create mode 100644 S2OJ/1991/data/16.in create mode 100644 S2OJ/1991/data/16.out create mode 100644 S2OJ/1991/data/17.in create mode 100644 S2OJ/1991/data/17.out create mode 100644 S2OJ/1991/data/18.in create mode 100644 S2OJ/1991/data/18.out create mode 100644 S2OJ/1991/data/19.in create mode 100644 S2OJ/1991/data/19.out create mode 100644 S2OJ/1991/data/2.in create mode 100644 S2OJ/1991/data/2.out create mode 100644 S2OJ/1991/data/20.in create mode 100644 S2OJ/1991/data/20.out create mode 100644 S2OJ/1991/data/3.in create mode 100644 S2OJ/1991/data/3.out create mode 100644 S2OJ/1991/data/4.in create mode 100644 S2OJ/1991/data/4.out create mode 100644 S2OJ/1991/data/5.in create mode 100644 S2OJ/1991/data/5.out create mode 100644 S2OJ/1991/data/6.in create mode 100644 S2OJ/1991/data/6.out create mode 100644 S2OJ/1991/data/7.in create mode 100644 S2OJ/1991/data/7.out create mode 100644 S2OJ/1991/data/8.in create mode 100644 S2OJ/1991/data/8.out create mode 100644 S2OJ/1991/data/9.in create mode 100644 S2OJ/1991/data/9.out create mode 100644 S2OJ/1991/data/problem.conf create mode 100644 S2OJ/1991/data/std.cpp create mode 100644 S2OJ/1991/data/val.cpp create mode 100644 S2OJ/1991/resources/gen.cpp diff --git a/S2OJ/1991/1991.cpp b/S2OJ/1991/1991.cpp new file mode 100644 index 00000000..4b8e3122 --- /dev/null +++ b/S2OJ/1991/1991.cpp @@ -0,0 +1,114 @@ +#include +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e4 + 5; +const int INF = 0x3f3f3f3f; + +int n, m, a[N]; +std::vector g[N], g2[N]; +int cnt, dfn[N], low[N]; +int scc_cnt, id[N], w[N], dist[N]; +bool vis[N]; +std::stack st; + +void tarjan(int u) { + dfn[u] = low[u] = ++cnt; + vis[u] = true; + st.push(u); + + for (int v : g[u]) { + if (!dfn[v]) { + tarjan(v); + low[u] = std::min(low[u], low[v]); + } else if (vis[v]) { + low[u] = std::min(low[u], dfn[v]); + } + } + + if (low[u] == dfn[u]) { + scc_cnt++; + + int v; + do { + v = st.top(); + st.pop(); + vis[v] = false; + id[v] = scc_cnt; + w[scc_cnt] += a[v]; + } while (v != u); + } +} + +int spfa(int s) { + std::fill_n(dist, N, -INF); + + int res = 0; + std::queue q; + + q.emplace(s); + dist[s] = 0; + + while (!q.empty()) { + int u = q.front(); + q.pop(); + + res = std::max(res, dist[u] + w[u]); + + for (int v : g2[u]) { + if (dist[v] < dist[u] + w[u]) { + dist[v] = dist[u] + w[u]; + q.push(v); + } + } + } + + return res; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m; + + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + + for (int i = 1, u, v; i <= m; i++) { + cin >> u >> v; + + g[u].emplace_back(v); + } + + for (int i = 1; i <= n; i++) { + if (!dfn[i]) { + tarjan(i); + } + } + + for (int i = 1; i <= n; i++) { + for (int v : g[i]) { + if (id[i] != id[v]) { + g2[id[i]].emplace_back(id[v]); + } + } + } + + int ans = 0; + + for (int i = 1; i <= scc_cnt; i++) { + ans = std::max(ans, spfa(i)); + } + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/1991/data/1.in b/S2OJ/1991/data/1.in new file mode 100644 index 00000000..d64d0e3e --- /dev/null +++ b/S2OJ/1991/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5745e2d97425f24814046bfc3e3714da628ad38aef961f6e1946b3de1877ad10 +size 976 diff --git a/S2OJ/1991/data/1.out b/S2OJ/1991/data/1.out new file mode 100644 index 00000000..82299f07 --- /dev/null +++ b/S2OJ/1991/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f2885d23756f68e27a6b4a95d28b207bc88bb2a80721ef9aaafde29ab86a5b3 +size 5 diff --git a/S2OJ/1991/data/10.in b/S2OJ/1991/data/10.in new file mode 100644 index 00000000..7470e6f3 --- /dev/null +++ b/S2OJ/1991/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dfb563139c0cb5b292baec11cb20e339ecee7c3548eb78ff101fee89e98cb36 +size 979 diff --git a/S2OJ/1991/data/10.out b/S2OJ/1991/data/10.out new file mode 100644 index 00000000..c30d9c74 --- /dev/null +++ b/S2OJ/1991/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e2b3105a700107e6cc77d06759c87c87214bf4ed3a165a6f00d61119be8b983 +size 5 diff --git a/S2OJ/1991/data/11.in b/S2OJ/1991/data/11.in new file mode 100644 index 00000000..20d29f6d --- /dev/null +++ b/S2OJ/1991/data/11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c058225b8d638a6937a40d08d5dd9871de17375a8a5248ed7fa1a9b5f9a9603 +size 136842 diff --git a/S2OJ/1991/data/11.out b/S2OJ/1991/data/11.out new file mode 100644 index 00000000..217af37b --- /dev/null +++ b/S2OJ/1991/data/11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7a67b304c977cf7e63fa125c7705584228c1a8cc75db5503e8c8873d66db1ee +size 6 diff --git a/S2OJ/1991/data/12.in b/S2OJ/1991/data/12.in new file mode 100644 index 00000000..e98e094a --- /dev/null +++ b/S2OJ/1991/data/12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37c2b6302ca89a07f2b2ecfe4a94ec0210820f1ed273d3bbb4b6944b414528b5 +size 136760 diff --git a/S2OJ/1991/data/12.out b/S2OJ/1991/data/12.out new file mode 100644 index 00000000..3f91e0f9 --- /dev/null +++ b/S2OJ/1991/data/12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bff247fab2d95de4bc441a2dbf4c9180aeb3532ad6a777306a3539e5ff193d5e +size 6 diff --git a/S2OJ/1991/data/13.in b/S2OJ/1991/data/13.in new file mode 100644 index 00000000..753935a0 --- /dev/null +++ b/S2OJ/1991/data/13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab56dcdf55a4038ce9171a1a76fa4152feb057a019f3e50820a3a0e2b39e38bf +size 136830 diff --git a/S2OJ/1991/data/13.out b/S2OJ/1991/data/13.out new file mode 100644 index 00000000..81f58f4d --- /dev/null +++ b/S2OJ/1991/data/13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e953bdd9a6daa637bca3ac04284a20517f501713caf441419c586cb388c5c6ab +size 6 diff --git a/S2OJ/1991/data/14.in b/S2OJ/1991/data/14.in new file mode 100644 index 00000000..cd0d205e --- /dev/null +++ b/S2OJ/1991/data/14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4337c4ef868dfd5fcb8a7417f2a55f5a6a35085d6cef4fbdc08f743107d8a0a9 +size 136715 diff --git a/S2OJ/1991/data/14.out b/S2OJ/1991/data/14.out new file mode 100644 index 00000000..7f38dda4 --- /dev/null +++ b/S2OJ/1991/data/14.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29b7d14c6387749919c666c1b302245e279db86bc7464a5db0f7ad107d2cf4fb +size 6 diff --git a/S2OJ/1991/data/15.in b/S2OJ/1991/data/15.in new file mode 100644 index 00000000..ae240772 --- /dev/null +++ b/S2OJ/1991/data/15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1cdfc402a2b57c9cc062cf85e842a18d85ba0a7318683c63c0eb947a88959370 +size 136733 diff --git a/S2OJ/1991/data/15.out b/S2OJ/1991/data/15.out new file mode 100644 index 00000000..d9ae779e --- /dev/null +++ b/S2OJ/1991/data/15.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6c9dfbfc102f3591b592aafc538c69395d03b0a02ab616c95ba6a745bb81e7a +size 6 diff --git a/S2OJ/1991/data/16.in b/S2OJ/1991/data/16.in new file mode 100644 index 00000000..573f5f29 --- /dev/null +++ b/S2OJ/1991/data/16.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a48bb13670506720ced59c903a1fda60bb8fe7137be5ee0b52b1a851318b4a79 +size 136718 diff --git a/S2OJ/1991/data/16.out b/S2OJ/1991/data/16.out new file mode 100644 index 00000000..f735aed8 --- /dev/null +++ b/S2OJ/1991/data/16.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0773f9129de256f20df15ac73bc3a6a1912be6167a572267c72a3f2e3fdfbcd2 +size 6 diff --git a/S2OJ/1991/data/17.in b/S2OJ/1991/data/17.in new file mode 100644 index 00000000..a1618aaf --- /dev/null +++ b/S2OJ/1991/data/17.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e504d9d1f2a41bffa2ab3a0b6e5859b2a131dafedd3197ebc0319d322a890a5 +size 136762 diff --git a/S2OJ/1991/data/17.out b/S2OJ/1991/data/17.out new file mode 100644 index 00000000..ac4bd938 --- /dev/null +++ b/S2OJ/1991/data/17.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccbd19fb75607d929aa1d34a79a97b9381e1d988d853b97ffc5a056585da837b +size 6 diff --git a/S2OJ/1991/data/18.in b/S2OJ/1991/data/18.in new file mode 100644 index 00000000..d1b43db1 --- /dev/null +++ b/S2OJ/1991/data/18.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94f078f436c02403c28210be93fd26a4f4bcc05f22ba827fd6e5de1e2dacb03a +size 136679 diff --git a/S2OJ/1991/data/18.out b/S2OJ/1991/data/18.out new file mode 100644 index 00000000..357e386f --- /dev/null +++ b/S2OJ/1991/data/18.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8af25cb32f75037edaf087e50b9fb9932486506fa07a0989b944854493f0045 +size 6 diff --git a/S2OJ/1991/data/19.in b/S2OJ/1991/data/19.in new file mode 100644 index 00000000..0bfe066b --- /dev/null +++ b/S2OJ/1991/data/19.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7189b83374053bb7f4047d67e4b82834e6ebfa87bfe27a9e6d1ea230a02cc902 +size 136697 diff --git a/S2OJ/1991/data/19.out b/S2OJ/1991/data/19.out new file mode 100644 index 00000000..a5367b89 --- /dev/null +++ b/S2OJ/1991/data/19.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dd1163d2646379e09e3e16eb319bcb7c2880ca8cec7a6a964560d8c8989fd71 +size 6 diff --git a/S2OJ/1991/data/2.in b/S2OJ/1991/data/2.in new file mode 100644 index 00000000..3a8c3474 --- /dev/null +++ b/S2OJ/1991/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61ceb2fb28a9a7aa0a11017fef0342af5c17a9d40367e5610cad32780a363ffd +size 986 diff --git a/S2OJ/1991/data/2.out b/S2OJ/1991/data/2.out new file mode 100644 index 00000000..15cbb844 --- /dev/null +++ b/S2OJ/1991/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9f385ee395ec75837cd0fa2a2e46c6bc91880def0159ae35ad6ffede82ec506 +size 6 diff --git a/S2OJ/1991/data/20.in b/S2OJ/1991/data/20.in new file mode 100644 index 00000000..02187531 --- /dev/null +++ b/S2OJ/1991/data/20.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a14ce597b3d46b53f4637858c80e871ccfe67dba96a6c69f94c255bc552ac778 +size 136775 diff --git a/S2OJ/1991/data/20.out b/S2OJ/1991/data/20.out new file mode 100644 index 00000000..d00ca312 --- /dev/null +++ b/S2OJ/1991/data/20.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deb6337823b14932ab36e08e332565ebf19538d46d0ee0b88d7a8709b6842590 +size 6 diff --git a/S2OJ/1991/data/3.in b/S2OJ/1991/data/3.in new file mode 100644 index 00000000..4259b24b --- /dev/null +++ b/S2OJ/1991/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ceab546f692b010dc2ba5a5dc19e09d3a8cb4f6966c0aa34fcb60d758b35bb8c +size 995 diff --git a/S2OJ/1991/data/3.out b/S2OJ/1991/data/3.out new file mode 100644 index 00000000..007a83f7 --- /dev/null +++ b/S2OJ/1991/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0b67778ce4256aeac48b6d9cee4a690221da0a6a54fe04c5205577a5e655662 +size 5 diff --git a/S2OJ/1991/data/4.in b/S2OJ/1991/data/4.in new file mode 100644 index 00000000..14d092ed --- /dev/null +++ b/S2OJ/1991/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bdfdb374522183cbb67460353c05112d14d1dd73ffd4855575d8429502eaa32 +size 983 diff --git a/S2OJ/1991/data/4.out b/S2OJ/1991/data/4.out new file mode 100644 index 00000000..3c8d3e99 --- /dev/null +++ b/S2OJ/1991/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba155dc82e1bad9b597d6dfaf2d15164893802a8b0cf51ee9f392006c4a89386 +size 6 diff --git a/S2OJ/1991/data/5.in b/S2OJ/1991/data/5.in new file mode 100644 index 00000000..1ae8b5b4 --- /dev/null +++ b/S2OJ/1991/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81b78a765c33f2efd15fba01de193bad671e9b27d63b73ba066804bb8e7bd3d7 +size 981 diff --git a/S2OJ/1991/data/5.out b/S2OJ/1991/data/5.out new file mode 100644 index 00000000..bc576108 --- /dev/null +++ b/S2OJ/1991/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cc9e01fec290825859e303fa58a50d9d9d8ce189dbc8d3c9c7abb89e3870db9 +size 5 diff --git a/S2OJ/1991/data/6.in b/S2OJ/1991/data/6.in new file mode 100644 index 00000000..771607b3 --- /dev/null +++ b/S2OJ/1991/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:283bc1d9076a60c8685b30d5c4e16407217e7442ba234d3293ced33543f8e988 +size 977 diff --git a/S2OJ/1991/data/6.out b/S2OJ/1991/data/6.out new file mode 100644 index 00000000..d29cc8de --- /dev/null +++ b/S2OJ/1991/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8882141c233c7ae867dba4400d0390a9db995524b7f0ec7ead82d5c04f53b6b2 +size 5 diff --git a/S2OJ/1991/data/7.in b/S2OJ/1991/data/7.in new file mode 100644 index 00000000..577c17f9 --- /dev/null +++ b/S2OJ/1991/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:095c8d7892c70c1208600849c1e2e1bd741874b6e63772085c01c50bccd1e715 +size 982 diff --git a/S2OJ/1991/data/7.out b/S2OJ/1991/data/7.out new file mode 100644 index 00000000..6c710a15 --- /dev/null +++ b/S2OJ/1991/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e4b0ef8506c38401ba72ff09141a4b8ee4cd1d03a732b18d65d5f1d80a57271 +size 5 diff --git a/S2OJ/1991/data/8.in b/S2OJ/1991/data/8.in new file mode 100644 index 00000000..b98ca256 --- /dev/null +++ b/S2OJ/1991/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dafcb022c6481ea61dad08543c84c5283f6e357cccd3b76a980bdc7d8d5126cc +size 966 diff --git a/S2OJ/1991/data/8.out b/S2OJ/1991/data/8.out new file mode 100644 index 00000000..da9dae8f --- /dev/null +++ b/S2OJ/1991/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bf8eb2ba7547ecd03db82fd03b516677e42b89fc38c15faea8f30fbbd8c0944 +size 5 diff --git a/S2OJ/1991/data/9.in b/S2OJ/1991/data/9.in new file mode 100644 index 00000000..bcfaf43a --- /dev/null +++ b/S2OJ/1991/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7228c3f3af0b16b1004127c1f20281886089aa2ab9839acdc2fde09f84dcf8e +size 979 diff --git a/S2OJ/1991/data/9.out b/S2OJ/1991/data/9.out new file mode 100644 index 00000000..887ebcb3 --- /dev/null +++ b/S2OJ/1991/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5349691905127d812ea760d66aeb3634f227ab194818316451bbf6f2d7a740d +size 6 diff --git a/S2OJ/1991/data/problem.conf b/S2OJ/1991/data/problem.conf new file mode 100644 index 00000000..66d63f30 --- /dev/null +++ b/S2OJ/1991/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b04bd69d1e90ae50798def10ec2329458117f9705bc48d51fa412f3c274c6264 +size 167 diff --git a/S2OJ/1991/data/std.cpp b/S2OJ/1991/data/std.cpp new file mode 100644 index 00000000..d8dbcb21 --- /dev/null +++ b/S2OJ/1991/data/std.cpp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fbdadc0b7f398198408529bc6748f5996a84459c0c28ba0ee8bc76a9a8e21a2 +size 2144 diff --git a/S2OJ/1991/data/val.cpp b/S2OJ/1991/data/val.cpp new file mode 100644 index 00000000..0d9bf739 --- /dev/null +++ b/S2OJ/1991/data/val.cpp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0216f74b11a8b0ede2aff18bbb03d33ed373a228fef3c0822a1ae6dfc998fd66 +size 726 diff --git a/S2OJ/1991/resources/gen.cpp b/S2OJ/1991/resources/gen.cpp new file mode 100644 index 00000000..163b7311 --- /dev/null +++ b/S2OJ/1991/resources/gen.cpp @@ -0,0 +1,57 @@ +/** + * @file S2OJ/1991/gen.cpp + * @author Baoshuo + * @url https://baoshuo.ren + * @license GPL-3.0 + * @date 2023-03-30 + */ + +#include "testlib.h" + +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +#define N_TESTS 20 +#define PERCENT_TESTS(_percent) (static_cast(_percent) / 100 * N_TESTS) + +int main(int argc, char* argv[]) { + registerGen(argc, argv, 1); + + int id = opt("id"); + + int min_n = 10000, + max_n = 10000; // 1e4 + int min_m = 10000, + max_m = 10000; // 1e4 + + if (id <= PERCENT_TESTS(50)) { + min_n = max_n = 100; + min_m = max_m = 100; + } else { // all tests + // (none) + } + + int n = rnd.next(min_n, max_n); + int m = rnd.next(min_m, max_m); + + cout << n << ' ' << m << endl; + + for (int i = 1; i <= n; i++) { + const char end_c = i < n ? ' ' : '\n'; + + cout << rnd.next(0, 1000) << end_c; + } + + for (int i = 1; i <= m; i++) { + int u = rnd.next(1, n); + int v = rnd.next(1, n); + + cout << u << ' ' << v << endl; + } + + return 0; +}