mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-24 00:08:47 +00:00
Compare commits
6 Commits
acbf73ce31
...
b1fdc7d76e
Author | SHA1 | Date | |
---|---|---|---|
b1fdc7d76e | |||
51e252392e | |||
5777c81c18 | |||
925330530c | |||
d7bd7cf57e | |||
ded1af697d |
@ -1,5 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
@ -10,19 +11,19 @@ const int N = 505,
|
|||||||
M = 5e4 + 5;
|
M = 5e4 + 5;
|
||||||
const int INF = 0x3f3f3f3f;
|
const int INF = 0x3f3f3f3f;
|
||||||
|
|
||||||
int n, m, e, s, t, flow, ans;
|
int n, m, e, s, t;
|
||||||
int idx, head[N << 1], ver[M << 2], edge[M << 2], next[M << 2];
|
int idx, head[N << 1], ver[M << 2], edge[M << 2], next[M << 2];
|
||||||
int d[N << 1], cur[N << 1];
|
int d[N << 1], cur[N << 1];
|
||||||
|
|
||||||
void add(int u, int v, int w) {
|
void add(int u, int v, int w) {
|
||||||
next[idx] = head[u];
|
|
||||||
ver[idx] = v;
|
ver[idx] = v;
|
||||||
edge[idx] = w;
|
edge[idx] = w;
|
||||||
|
next[idx] = head[u];
|
||||||
head[u] = idx++;
|
head[u] = idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bfs() {
|
bool bfs() {
|
||||||
std::fill_n(d, N << 1, 0);
|
std::fill(std::begin(d), std::end(d), 0);
|
||||||
|
|
||||||
std::queue<int> q;
|
std::queue<int> q;
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ bool bfs() {
|
|||||||
int v = ver[i],
|
int v = ver[i],
|
||||||
w = edge[i];
|
w = edge[i];
|
||||||
|
|
||||||
if (w && !d[v]) {
|
if (!d[v] && w) {
|
||||||
d[v] = d[u] + 1;
|
d[v] = d[u] + 1;
|
||||||
cur[v] = head[v];
|
cur[v] = head[v];
|
||||||
if (v == t) return true;
|
if (v == t) return true;
|
||||||
@ -54,20 +55,21 @@ int dinic(int u, int limit) {
|
|||||||
if (u == t) return limit;
|
if (u == t) return limit;
|
||||||
|
|
||||||
int flow = 0;
|
int flow = 0;
|
||||||
|
|
||||||
for (int i = cur[u]; ~i && flow < limit; i = next[i]) {
|
for (int i = cur[u]; ~i && flow < limit; i = next[i]) {
|
||||||
cur[u] = i;
|
cur[u] = i;
|
||||||
|
|
||||||
int v = ver[i],
|
int v = ver[i],
|
||||||
w = edge[i];
|
w = edge[i];
|
||||||
|
|
||||||
if (w && d[v] == d[u] + 1) {
|
if (d[v] == d[u] + 1 && w) {
|
||||||
int k = dinic(v, std::min(limit - flow, w));
|
int k = dinic(v, std::min(limit - flow, w));
|
||||||
|
|
||||||
if (!k) d[v] = 0;
|
if (!k) d[v] = 0;
|
||||||
|
|
||||||
|
flow += k;
|
||||||
edge[i] -= k;
|
edge[i] -= k;
|
||||||
edge[i ^ 1] += k;
|
edge[i ^ 1] += k;
|
||||||
flow += k;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ int main() {
|
|||||||
std::ios::sync_with_stdio(false);
|
std::ios::sync_with_stdio(false);
|
||||||
cin.tie(nullptr);
|
cin.tie(nullptr);
|
||||||
|
|
||||||
std::fill_n(head, N << 1, -1);
|
std::fill(std::begin(head), std::end(head), -1);
|
||||||
|
|
||||||
cin >> n >> m >> e;
|
cin >> n >> m >> e;
|
||||||
|
|
||||||
@ -97,15 +99,17 @@ int main() {
|
|||||||
for (int i = 1, u, v; i <= e; i++) {
|
for (int i = 1, u, v; i <= e; i++) {
|
||||||
cin >> u >> v;
|
cin >> u >> v;
|
||||||
|
|
||||||
add(u, n + v, 1);
|
add(u, v + n, 1);
|
||||||
add(n + v, u, 0);
|
add(v + n, u, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
while (bfs()) {
|
while (bfs()) {
|
||||||
while (flow = dinic(s, INF)) ans += flow;
|
while (int flow = dinic(s, INF)) res += flow;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << ans << endl;
|
cout << res << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,57 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
const char endl = '\n';
|
const char endl = '\n';
|
||||||
|
|
||||||
const int N = 1.1e7 + 5;
|
std::vector<int> manacher(std::string _s) {
|
||||||
|
// s = "abba" -> "^#a#b#b#a#$"
|
||||||
|
int n = _s.size();
|
||||||
|
std::string s(n * 2 + 3, '#');
|
||||||
|
|
||||||
int p[N << 1], mid, r, ans;
|
for (int i = 0; i < n; i++) {
|
||||||
std::string s1, s2;
|
s[i * 2 + 2] = _s[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
s[0] = '^';
|
||||||
|
s[n * 2 + 2] = '$';
|
||||||
|
|
||||||
|
std::vector<int> p(s.size(), 1);
|
||||||
|
|
||||||
|
for (int i = 1, mid = 0, r = 0; i <= n * 2 + 1; i++) {
|
||||||
|
p[i] = i < r ? std::min(p[mid * 2 - i], r - i) : 1;
|
||||||
|
|
||||||
|
while (s[i - p[i]] == s[i + p[i]]) p[i]++;
|
||||||
|
|
||||||
|
if (i + p[i] - 1 > r) {
|
||||||
|
r = i + p[i] - 1;
|
||||||
|
mid = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (int i = 0; i < n; i++) {
|
||||||
|
// p[i] = p[i * 2 + 2] / 2;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// p.resize(n);
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::ios::sync_with_stdio(false);
|
std::ios::sync_with_stdio(false);
|
||||||
cin.tie(nullptr);
|
cin.tie(nullptr);
|
||||||
|
|
||||||
cin >> s1;
|
std::string s;
|
||||||
|
|
||||||
// Init
|
cin >> s;
|
||||||
|
|
||||||
s2.push_back('^');
|
auto p = manacher(s);
|
||||||
for (const char &c : s1) {
|
|
||||||
s2.push_back('#');
|
|
||||||
s2.push_back(c);
|
|
||||||
}
|
|
||||||
s2 += "#$";
|
|
||||||
|
|
||||||
for (int i = 1; i < s2.size(); i++) {
|
cout << *std::max_element(p.begin(), p.end()) - 1 << endl;
|
||||||
p[i] = i < r ? std::min(p[mid * 2 - i], r - i) : 1;
|
|
||||||
|
|
||||||
while (s2[i - p[i]] == s2[i + p[i]]) p[i]++;
|
|
||||||
|
|
||||||
if (i + p[i] > r) {
|
|
||||||
r = i + p[i];
|
|
||||||
mid = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < s2.size(); i++) {
|
|
||||||
ans = std::max(ans, p[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << ans - 1 << endl;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,67 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iterator>
|
||||||
|
#include <limits>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
const char endl = '\n';
|
const char endl = '\n';
|
||||||
|
|
||||||
const int N = 55;
|
const int N = 1e5 + 5;
|
||||||
|
|
||||||
int n;
|
template <typename T>
|
||||||
long long x, a[N], ans;
|
struct LinearBasis
|
||||||
|
: std::enable_if<std::is_unsigned<T>::value, T> {
|
||||||
|
T a[std::numeric_limits<T>::digits];
|
||||||
|
|
||||||
void insert(long long x) {
|
LinearBasis() {
|
||||||
for (int i = 50; ~i; i--) {
|
std::fill(std::begin(a), std::end(a), 0);
|
||||||
if (!(x & (1ll << i))) continue;
|
}
|
||||||
|
|
||||||
|
void insert(unsigned long long x) {
|
||||||
|
for (int i = std::numeric_limits<T>::digits - 1; ~i; i--) {
|
||||||
|
if ((x >> i) & 1) {
|
||||||
if (a[i]) {
|
if (a[i]) {
|
||||||
x ^= a[i];
|
x ^= a[i];
|
||||||
} else {
|
} else {
|
||||||
for (int k = 0; k < i; k++) {
|
|
||||||
if (x & (1ll << k)) x ^= a[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int k = i + 1; k <= 50; k++) {
|
|
||||||
if (a[k] & (1ll << i)) a[k] ^= x;
|
|
||||||
}
|
|
||||||
|
|
||||||
a[i] = x;
|
a[i] = x;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
T query() {
|
||||||
|
T res(0);
|
||||||
|
|
||||||
|
for (int i = std::numeric_limits<T>::digits - 1; ~i; i--) {
|
||||||
|
if ((res ^ a[i]) > res) res ^= a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::ios::sync_with_stdio(false);
|
std::ios::sync_with_stdio(false);
|
||||||
cin.tie(nullptr);
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
int n;
|
||||||
|
LinearBasis<unsigned long long> lb;
|
||||||
|
|
||||||
cin >> n;
|
cin >> n;
|
||||||
|
|
||||||
for (int i = 1; i <= n; i++) {
|
for (int i = 1; i <= n; i++) {
|
||||||
|
unsigned long long x;
|
||||||
|
|
||||||
cin >> x;
|
cin >> x;
|
||||||
|
|
||||||
insert(x);
|
lb.insert(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i <= 50; i++) ans ^= a[i];
|
cout << lb.query() << endl;
|
||||||
|
|
||||||
cout << ans << endl;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
BIN
Luogu/P3812/data/P3812_2.in
(Stored with Git LFS)
Normal file
BIN
Luogu/P3812/data/P3812_2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Luogu/P3812/data/P3812_2.out
(Stored with Git LFS)
Normal file
BIN
Luogu/P3812/data/P3812_2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
56
S2OJ/1970/1970.cpp
Normal file
56
S2OJ/1970/1970.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1e5 + 5;
|
||||||
|
const int mod = 1e9 + 7;
|
||||||
|
|
||||||
|
int n, m, a[N], b[N];
|
||||||
|
long long ans1, ans2, ans3;
|
||||||
|
|
||||||
|
long long binpow(long long a, long long b, long long mod = ::mod) {
|
||||||
|
a %= mod;
|
||||||
|
|
||||||
|
long long res = 1;
|
||||||
|
|
||||||
|
while (b) {
|
||||||
|
if (b & 1) res = res * a % mod;
|
||||||
|
a = a * a % mod;
|
||||||
|
b >>= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
b[n - i + 1] = a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
long long x = binpow(2, m - 1);
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
ans1 = (((ans1 + static_cast<long long>(a[i]) * ((static_cast<long long>(x + 1) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
ans2 = (((ans2 + static_cast<long long>(b[i]) * ((static_cast<long long>(x + 1) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
ans3 = (((ans3 + static_cast<long long>(a[i]) * ((static_cast<long long>(x) * n - i + 1) % mod + mod % mod) % mod * x) % mod) + mod) % mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << std::max(((ans1 + ans3) % mod + mod) % mod, ((ans2 + ans3) % mod + mod) % mod) << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/1970/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq21.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq21.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq22.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq22.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq23.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq23.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq24.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq24.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq25.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq25.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq26.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq26.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq27.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq27.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq28.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq28.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq29.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq29.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq30.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq30.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq31.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq31.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq32.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq32.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/seq9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/seq9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/std.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/std.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1970/data/val.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1970/data/val.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
54
S2OJ/1971/1971.cpp
Normal file
54
S2OJ/1971/1971.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1005;
|
||||||
|
const double eps = 1e-6;
|
||||||
|
|
||||||
|
int n, m, c;
|
||||||
|
double p, f[N][N];
|
||||||
|
|
||||||
|
bool check(double x) {
|
||||||
|
for (int i = 0; i <= m; i++) {
|
||||||
|
f[0][i] = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
for (int j = 1; j <= m; j++) {
|
||||||
|
f[i][j] = std::min(x, f[i - 1][j] * (1.0 - p) + f[i][j - 1] * p + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return f[n][m] < x;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
cin >> n >> m >> c;
|
||||||
|
|
||||||
|
p = c / 100.0;
|
||||||
|
|
||||||
|
double l = 0,
|
||||||
|
r = 1e9,
|
||||||
|
res = 1e9;
|
||||||
|
|
||||||
|
while (r - l > eps) {
|
||||||
|
double mid = (l + r) / 2;
|
||||||
|
|
||||||
|
if (check(mid)) {
|
||||||
|
r = mid;
|
||||||
|
res = mid;
|
||||||
|
} else {
|
||||||
|
l = mid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << std::fixed << std::setprecision(12) << res << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
S2OJ/1971/data/boss1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss100.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss100.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss100.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss100.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1971/data/boss2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1971/data/boss2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user