diff --git a/S2OJ/896/896.cpp b/S2OJ/896/896.cpp new file mode 100644 index 00000000..72272605 --- /dev/null +++ b/S2OJ/896/896.cpp @@ -0,0 +1,46 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 6005; +const int mod = 1e9 + 7; + +int n, f[N][2], ans; +std::pair a[N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + cin >> a[i].first >> a[i].second; + } + + std::sort(a + 1, a + 1 + n); + + f[1][0] = f[1][1] = 1; + for (int i = 2; i <= n; i++) { + f[i][0] = f[i][1] = 1; + + for (int j = i - 1; j; j--) { + if (a[j].second > a[i].second) { + f[j][1] = (f[j][1] + f[i][0]) % mod; + } else { + f[i][0] = (f[i][0] + f[j][1]) % mod; + } + } + } + + for (int i = 1; i <= n; i++) { + ans = (static_cast(ans) + f[i][0] + f[i][1] - 1) % mod; + } + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/896/data/problem.conf b/S2OJ/896/data/problem.conf new file mode 100644 index 00000000..6f59d9bc --- /dev/null +++ b/S2OJ/896/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e09ecb26bcab497602c3f2acb8c5648bef9c483d5116f44b0b91f5f516df0269 +size 214 diff --git a/S2OJ/896/data/refract1.in b/S2OJ/896/data/refract1.in new file mode 100644 index 00000000..a8730d21 --- /dev/null +++ b/S2OJ/896/data/refract1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a278cb8f65fac55bbbf1b2bdf445ed3c5c99b9a3c2b3b99b641932d111ba57e4 +size 6877 diff --git a/S2OJ/896/data/refract1.out b/S2OJ/896/data/refract1.out new file mode 100644 index 00000000..2e0dfc63 --- /dev/null +++ b/S2OJ/896/data/refract1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44a30093d4b3a2068c357ac00e49f76312b138803cc37a4cdec9df0e6977301c +size 10 diff --git a/S2OJ/896/data/refract10.in b/S2OJ/896/data/refract10.in new file mode 100644 index 00000000..530ce9b9 --- /dev/null +++ b/S2OJ/896/data/refract10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2b996a7f1a912f48a358b08372e114955e2ac4495a4783a759900584cf9a2b3 +size 4541 diff --git a/S2OJ/896/data/refract10.out b/S2OJ/896/data/refract10.out new file mode 100644 index 00000000..d4c677af --- /dev/null +++ b/S2OJ/896/data/refract10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d0fccf3de312e68ab008bc1dddb3ae72aa84105141e21f568a18388c867b301 +size 10 diff --git a/S2OJ/896/data/refract2.in b/S2OJ/896/data/refract2.in new file mode 100644 index 00000000..c9a4f50b --- /dev/null +++ b/S2OJ/896/data/refract2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76f20ad2ecd8bb9a4b867768385d54c7466126d7a0ab45be6d4c5ce724a06b9f +size 75927 diff --git a/S2OJ/896/data/refract2.out b/S2OJ/896/data/refract2.out new file mode 100644 index 00000000..d3b3a9e2 --- /dev/null +++ b/S2OJ/896/data/refract2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c312d2bc3dd159649d89b6fa6f0b2f0e22632ffa66755c1488c57501d8d680c8 +size 10 diff --git a/S2OJ/896/data/refract3.in b/S2OJ/896/data/refract3.in new file mode 100644 index 00000000..9fbe7c4b --- /dev/null +++ b/S2OJ/896/data/refract3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bad919a37d575250dc8251a2aa79f07af81d6126d042f6fc679f6cabd5397e27 +size 78305 diff --git a/S2OJ/896/data/refract3.out b/S2OJ/896/data/refract3.out new file mode 100644 index 00000000..e74e382f --- /dev/null +++ b/S2OJ/896/data/refract3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1929aa02cc08f0ce89833896a841d65e8da154593a7505132d13b50c59899cde +size 10 diff --git a/S2OJ/896/data/refract4.in b/S2OJ/896/data/refract4.in new file mode 100644 index 00000000..6fd19537 --- /dev/null +++ b/S2OJ/896/data/refract4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a9fa1555a4633924c6f3233b2b072b9d43fa20b29edffa22591dc65e07530df +size 80263 diff --git a/S2OJ/896/data/refract4.out b/S2OJ/896/data/refract4.out new file mode 100644 index 00000000..e6b25e74 --- /dev/null +++ b/S2OJ/896/data/refract4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8b5409042dba6494621ce74f1a0da1e277a183b920abd9468589b6890e15b53 +size 10 diff --git a/S2OJ/896/data/refract5.in b/S2OJ/896/data/refract5.in new file mode 100644 index 00000000..e0328ef7 --- /dev/null +++ b/S2OJ/896/data/refract5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d829db4ff0f512bcda4d54da11f36b819ebafd0320cdfe0c66db6baeb76820f2 +size 102978 diff --git a/S2OJ/896/data/refract5.out b/S2OJ/896/data/refract5.out new file mode 100644 index 00000000..26455b5c --- /dev/null +++ b/S2OJ/896/data/refract5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90c890c313031a0310ea075764f079b4a42550c01c3fe389b44d5e32fa8adc28 +size 10 diff --git a/S2OJ/896/data/refract6.in b/S2OJ/896/data/refract6.in new file mode 100644 index 00000000..0b210f97 --- /dev/null +++ b/S2OJ/896/data/refract6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:774228fd6f2bea72797d8b3255013f1ec48f57bcfa6b149a2384745835e04153 +size 120420 diff --git a/S2OJ/896/data/refract6.out b/S2OJ/896/data/refract6.out new file mode 100644 index 00000000..c436d538 --- /dev/null +++ b/S2OJ/896/data/refract6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f713d6829dd2cdeff6382974be2f7c824164cdb16d6279db5199329b783aa0cd +size 10 diff --git a/S2OJ/896/data/refract7.in b/S2OJ/896/data/refract7.in new file mode 100644 index 00000000..c3578763 --- /dev/null +++ b/S2OJ/896/data/refract7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:894e278473748e7cbf5ef945bcc20d232c491062443ca0dc82ded3c0477e4f44 +size 106621 diff --git a/S2OJ/896/data/refract7.out b/S2OJ/896/data/refract7.out new file mode 100644 index 00000000..0e979139 --- /dev/null +++ b/S2OJ/896/data/refract7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e4b6cacff4015f46d3dd63d0abeb496955c59ce0d36388dd3f7969af5edb449 +size 10 diff --git a/S2OJ/896/data/refract8.in b/S2OJ/896/data/refract8.in new file mode 100644 index 00000000..1d717ad0 --- /dev/null +++ b/S2OJ/896/data/refract8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8156583e2a0a85a7d760925ff43c19701edb0bc0f701d87a769838a6a332912d +size 119329 diff --git a/S2OJ/896/data/refract8.out b/S2OJ/896/data/refract8.out new file mode 100644 index 00000000..de08c34f --- /dev/null +++ b/S2OJ/896/data/refract8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c6e2326ae59ad9c8c3fc39ea506f54fef2bebf444f287f6812061f9720529ac +size 10 diff --git a/S2OJ/896/data/refract9.in b/S2OJ/896/data/refract9.in new file mode 100644 index 00000000..1428b721 --- /dev/null +++ b/S2OJ/896/data/refract9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd1f2bd21ca7be93b9da2f8d26fda926461ae34fe68cea44ccb4a29568c41b0a +size 108196 diff --git a/S2OJ/896/data/refract9.out b/S2OJ/896/data/refract9.out new file mode 100644 index 00000000..2981afe2 --- /dev/null +++ b/S2OJ/896/data/refract9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e447177050c48279910a4c07ba73fb56377c7d13ad6d7e92a1ef8c10266a33fa +size 10