diff --git a/S2OJ/1493/1493.cpp b/S2OJ/1493/1493.cpp new file mode 100644 index 00000000..65d48094 --- /dev/null +++ b/S2OJ/1493/1493.cpp @@ -0,0 +1,48 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 25; + +int r, p, s, f[1 << N]; +std::string sr[N], sp[N], ss[N]; + +int highbit(int x) { + return 32 - __builtin_clz(x) - 1; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> r >> p >> s; + + sr[0] = "R", sp[0] = "P", ss[0] = "S"; + + for (int i = 1; i <= 20; i++) { + f[1 << i] = i; + } + + for (int i = 1; i <= 20; ++i) { + sp[i] = std::min(sr[i - 1] + ss[i - 1], ss[i - 1] + sr[i - 1]); + sr[i] = std::min(ss[i - 1] + sp[i - 1], sp[i - 1] + ss[i - 1]); + ss[i] = std::min(sp[i - 1] + sr[i - 1], sr[i - 1] + sp[i - 1]); + } + + if (f[r + p + s] == -1) { + cout << "IMPOSSIBLE" << endl; + } else if (r != p && r != s && p == s && std::abs(r - s) == 1) { + cout << sr[f[r + p + s]] << endl; + } else if (p != r && p != s && r == s && std::abs(p - r) == 1) { + cout << sp[f[r + p + s]] << endl; + } else if (s != p && s != r && p == r && std::abs(s - p) == 1) { + cout << ss[f[r + p + s]] << endl; + } else { + cout << "IMPOSSIBLE" << endl; + } + + return 0; +} diff --git a/S2OJ/1493/data/data1.in b/S2OJ/1493/data/data1.in new file mode 100644 index 00000000..3210902f --- /dev/null +++ b/S2OJ/1493/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce05c204ff512d9fc2b2c25b2c1dbcbb5d731d6e8652bf35ee798862fdea29d8 +size 6 diff --git a/S2OJ/1493/data/data1.out b/S2OJ/1493/data/data1.out new file mode 100644 index 00000000..782e4506 --- /dev/null +++ b/S2OJ/1493/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e1264500489cb37ac2cc9cf9a6510baf79265e21f9ab345230793b8aaee010 +size 3 diff --git a/S2OJ/1493/data/data10.in b/S2OJ/1493/data/data10.in new file mode 100644 index 00000000..cf885c32 --- /dev/null +++ b/S2OJ/1493/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:edb7bb11f5db3985168293975a30f585621b0dc10a22b2f1669526844c3e3fb9 +size 21 diff --git a/S2OJ/1493/data/data10.out b/S2OJ/1493/data/data10.out new file mode 100644 index 00000000..75d205bd --- /dev/null +++ b/S2OJ/1493/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eea681eb690c5b22f9f3472249403b78e90c12609f14a2f897416420c572576d +size 1048577 diff --git a/S2OJ/1493/data/data2.in b/S2OJ/1493/data/data2.in new file mode 100644 index 00000000..7acda7f6 --- /dev/null +++ b/S2OJ/1493/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31d8674703636e8e9bbe2fcc81c46fda3a12e400cc48c0c25c0ad3fe7ea44aa2 +size 21 diff --git a/S2OJ/1493/data/data2.out b/S2OJ/1493/data/data2.out new file mode 100644 index 00000000..a4eb227f --- /dev/null +++ b/S2OJ/1493/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13c6e581be2e2d9dcf603e8be52505c18faae3b5cfa5505fef9919c63302f725 +size 1048577 diff --git a/S2OJ/1493/data/data3.in b/S2OJ/1493/data/data3.in new file mode 100644 index 00000000..1d1cea1e --- /dev/null +++ b/S2OJ/1493/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc154c73f4ca5ce9d71da86372937939c3d0894364ca7cee8e49aa177da41588 +size 21 diff --git a/S2OJ/1493/data/data3.out b/S2OJ/1493/data/data3.out new file mode 100644 index 00000000..5d3275ab --- /dev/null +++ b/S2OJ/1493/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f398ce2ab47ccbbf5a5f2faf5bdd800a327d370301e45c77a7a107ddfb366c1 +size 1048577 diff --git a/S2OJ/1493/data/data4.in b/S2OJ/1493/data/data4.in new file mode 100644 index 00000000..f6bb068c --- /dev/null +++ b/S2OJ/1493/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2be1e5cca7771ca5752d14b4738f7fbca6f6be405f671dca2f595a0fee2a2db +size 16 diff --git a/S2OJ/1493/data/data4.out b/S2OJ/1493/data/data4.out new file mode 100644 index 00000000..c850ed36 --- /dev/null +++ b/S2OJ/1493/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9584980048d9de2c9e87643fafd8c33b56cfd1e45dba13926b77e708936efa10 +size 11 diff --git a/S2OJ/1493/data/data5.in b/S2OJ/1493/data/data5.in new file mode 100644 index 00000000..751362a2 --- /dev/null +++ b/S2OJ/1493/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:086b0405fdd65642876da20f483296951854204dcaf748baa59ce7eaad52ca77 +size 6 diff --git a/S2OJ/1493/data/data5.out b/S2OJ/1493/data/data5.out new file mode 100644 index 00000000..ecb08cd4 --- /dev/null +++ b/S2OJ/1493/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91e62be2b50f4189886a1dcf99424de8c6ec55aa2c115db497c97c9cb7e699ff +size 9 diff --git a/S2OJ/1493/data/data6.in b/S2OJ/1493/data/data6.in new file mode 100644 index 00000000..83a71c3b --- /dev/null +++ b/S2OJ/1493/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f694e60fedd1a11c3c471f643ad66cebea7ef89f8adcf5ee21b58c9aea1abc3 +size 6 diff --git a/S2OJ/1493/data/data6.out b/S2OJ/1493/data/data6.out new file mode 100644 index 00000000..889ef8fd --- /dev/null +++ b/S2OJ/1493/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:673cd2615f44d8bc02ab62379556c428af01e756c48e2fa8acd568fe61c3b537 +size 17 diff --git a/S2OJ/1493/data/data7.in b/S2OJ/1493/data/data7.in new file mode 100644 index 00000000..226c89cf --- /dev/null +++ b/S2OJ/1493/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6d1a778105fe9527b73800dbecb60911ede0b9f883902d55bc692292d00e682 +size 12 diff --git a/S2OJ/1493/data/data7.out b/S2OJ/1493/data/data7.out new file mode 100644 index 00000000..18eb490f --- /dev/null +++ b/S2OJ/1493/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42c3308e5307a6e2ae5bc67458760b9475597b82aee31a5119d1e4fcd014f86b +size 1025 diff --git a/S2OJ/1493/data/data8.in b/S2OJ/1493/data/data8.in new file mode 100644 index 00000000..ed828f97 --- /dev/null +++ b/S2OJ/1493/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39d18a958c965bbc08a9fba05d73bfb900faa97c62d926fb113e839dcdb641bd +size 18 diff --git a/S2OJ/1493/data/data8.out b/S2OJ/1493/data/data8.out new file mode 100644 index 00000000..a5b80725 --- /dev/null +++ b/S2OJ/1493/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c87b347d0104aed2bd2523206245fc89b180731c76bc37cdc9d98ecf248edff +size 262145 diff --git a/S2OJ/1493/data/data9.in b/S2OJ/1493/data/data9.in new file mode 100644 index 00000000..6f8b3827 --- /dev/null +++ b/S2OJ/1493/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62a00947e1bc4b7c546fc8af2a0084ca1fb46d41e283f7d62ba89c731606a29b +size 21 diff --git a/S2OJ/1493/data/data9.out b/S2OJ/1493/data/data9.out new file mode 100644 index 00000000..a397b80e --- /dev/null +++ b/S2OJ/1493/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2354827aaa7f07240a00f54ca7c5463cadd5de1746638b46fd4a42590b1682aa +size 524289 diff --git a/S2OJ/1493/data/problem.conf b/S2OJ/1493/data/problem.conf new file mode 100644 index 00000000..c033b9ab --- /dev/null +++ b/S2OJ/1493/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d2de0d1705ef7f78975d536111e85f48bda27a2c93f2ed1be531ea0e4c95504 +size 177