Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int dy[] = {0, 1, 0, -1}; const int dx[] = {1, 0, -1, 0}; using LL = long long int; using LD = long double; const int INF = (1 << 30) - 1; const LL INF64 = ((LL)1 << 62) - 1; const double PI = 3.1415926535897932384626433832795; using pii = pair<int, int>; using pll = pair<LL, LL>; using pdd = pair<double, double>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using vl = vector<LL>; using vvl = vector<vl>; using vvvl = vector<vvl>; using vd = vector<double>; using vvd = vector<vd>; using vs = vector<string>; using vb = vector<bool>; using vvb = vector<vb>; int main() { LL x, p; cin >> x >> p; LD n; if (x % 2 == 0) { n = x / 2; printf("%.7lf\n", n); } else { n = (x + 1) / 2; printf("%.7lf\n", n); } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class T> using vv = vector<vector<T>>; template <class T> ostream &operator<<(ostream &os, const vector<T> &t) { os << "{"; for (int(i) = 0; (i) < (t.size()); ++(i)) { os << t[i] << ","; } os << "}" << endl; return os; } template <class S, class T> ostream &operator<<(ostream &os, const pair<S, T> &t) { return os << "(" << t.first << "," << t.second << ")"; } template <class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; } template <class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; } const long long MOD = 1e9 + 7; double fun(int x, double pp) { if (!x) return 0; --x; double re = 0, p = pow(pp, x); for (int(i) = 0; (i) < (1e6); ++(i)) { re += p; p *= x + i + 1; p /= i + 1; p *= 1 - pp; } return re; } int main() { ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); int x, p; cin >> x >> p; double pp = p * 0.01; if (x % 2) { cout << fun(x / 2, pp) * pp + fun(x / 2 + 1, pp) * (1 - pp) + 1 << endl; } else { cout << fun(x / 2, pp); } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; cout << x / 2 + x % 2; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int p, x; cin >> x >> p; if (x % 2 == 0) cout << x / 2; else cout << (x + 1) / 2; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long double p, n; int main() { cin >> n >> p; p = 100.0l - p; p /= 100.0l; long double ans = n / (2 - p * 2); printf("%.14Lf\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int x, p; int main(void) { scanf("%d%d", &x, &p); int ans = x / 2; if (ans % 2 == 1) { ans++; } printf("%d\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double p; int x; int main() { cin >> x >> p; if (x % 2 == 1) x++; cout << setprecision(8) << x / (2 * p) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#{{{ header {.hints:off} import algorithm, sequtils, tables, macros, math, sets, strutils, streams when defined(MYDEBUG): import header proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.} proc getchar(): char {.header: "<stdio.h>", varargs.} proc nextInt(base:int = 0): int = scanf("%lld",addr result) result -= base proc nextFloat(): float = scanf("%lf",addr result) proc nextString(): string = var get = false;result = "" while true: var c = getchar() if int(c) > int(' '): get = true;result.add(c) elif get: break template `max=`*(x,y:typed):void = x = max(x,y) template `min=`*(x,y:typed):void = x = min(x,y) template infty(T): untyped = ((T(1) shl T(sizeof(T)*8-2)) - 1) #}}} proc solve(x:int, p:int) = var fp = float(p)/100.0 proc calc(x:int):float = assert x mod 2 == 0 return float(x)/(2.0*fp) if x mod 2 == 0: echo calc(x) else: echo calc(x-1)*fp + calc(x+1)*(1.0-fp) return #{{{ main function proc main() = var x = 0 x = nextInt() var p = 0 p = nextInt() solve(x, p); return main() #}}}
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 200; map<tuple<int, int, int>, double> dp; double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } int res = abs(pos_ao - pos_cho); if (res > 20) return INF; if (turn >= MAX_TURN) { return INF; } double pro = (double)P / 100; if (dp.count(make_tuple(turn, pos_ao, pos_cho)) > 0) { return dp[make_tuple(turn, pos_ao, pos_cho)]; } double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); dp[make_tuple(turn, pos_ao, pos_cho)] = result; return result; } int main() { cin >> X >> P; if (X > 10) return 0; double result = memo(0, 0, X); printf("%.20lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; assert(p == 100); if (p == 100) { int tim = (x + 1) / 2; cout << tim << endl; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } vector<double> dp(1000); dp[x - 1] = 1; double out = 0; for (int i = 0; i < 1000; i++) { vector<double> ndp(1000); for (int j = i + 1; j < 1000; j++) { if (j) ndp[j - 1] += dp[j] * p / 100; if (j != 399) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 1; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.io.*; import java.util.*; import java.util.function.IntPredicate; public class Main { class Graph { Node[] nodes; public Graph(int n) { nodes = new Node[n]; for (int i = 0; i < n; i++) { nodes[i] = new Node(i); } } public void addEdge(int from, int to, int weight) { nodes[from].add(new Edge(nodes[from], nodes[to], weight)); } public void addBiEdge(int n1, int n2, int weight) { addEdge(n1, n2, weight); addEdge(n2, n1, weight); } } class Node extends ArrayList<Edge> { int idx; int distance = Integer.MAX_VALUE; int prev; public Node(int idx) { this.idx = idx; } } class Edge { Node from; Node to; int weight; public Edge(Node from, Node to, int weight) { this.from = from; this.to = to; this.weight = weight; } } long X, P; public void solve(){ X = nextLong(); P = nextLong(); out.println((X + 1) / 2); } //負の値でその集合の数 class UnionFind{ int[] tree; public UnionFind(int n){ tree = new int[n]; for(int i = 0; i < n; i++){ tree[i] = -1; } } public int root(int x){ if(tree[x] < 0) return x; else return tree[x] = root(tree[x]); } public boolean find(int x, int y){ return root(x) == root(y); } public int union(int x, int y){ x = root(x); y = root(y); if(x != y){ if(tree[x] < tree[y]){ tree[y] += tree[x]; tree[x] = y; return -tree[y]; }else{ tree[x] += tree[y]; tree[y] = x; return -tree[x]; } } return -tree[x]; } public int size(int x){ return -tree[root(x)]; } } private static PrintWriter out; public static void main(String[] args) { out = new PrintWriter(System.out); new Main().solve(); out.flush(); } public static int nextInt() { int num = 0; String str = next(); boolean minus = false; int i = 0; if (str.charAt(0) == '-') { minus = true; i++; } int len = str.length(); for (; i < len; i++) { char c = str.charAt(i); if (!('0' <= c && c <= '9')) throw new RuntimeException(); num = num * 10 + (c - '0'); } return minus ? -num : num; } public static long nextLong() { long num = 0; String str = next(); boolean minus = false; int i = 0; if (str.charAt(0) == '-') { minus = true; i++; } int len = str.length(); for (; i < len; i++) { char c = str.charAt(i); if (!('0' <= c && c <= '9')) throw new RuntimeException(); num = num * 10l + (c - '0'); } return minus ? -num : num; } public static String next() { int c; while (!isAlNum(c = read())) { } StringBuilder build = new StringBuilder(); build.append((char) c); while (isAlNum(c = read())) { build.append((char) c); } return build.toString(); } private static byte[] inputBuffer = new byte[1024]; private static int bufferLength = 0; private static int bufferIndex = 0; private static int read() { if (bufferLength < 0) throw new RuntimeException(); if (bufferIndex >= bufferLength) { try { bufferLength = System.in.read(inputBuffer); bufferIndex = 0; } catch (IOException e) { throw new RuntimeException(e); } if (bufferLength <= 0) return (bufferLength = -1); } return inputBuffer[bufferIndex++]; } private static boolean isAlNum(int c) { return '!' <= c && c <= '~'; } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { cin >> x >> p; cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; double xx = x / 2 + x % 2; cout << xx / p * 100; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
python3
import sys X = int(sys.stdin.readline()) P = int(sys.stdin.readline()) print((X+1)//2)
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long x; double p; cin >> x >> p; if (x % 2 == 1) { x++; } x /= 2; double y = x; cout << x / p * 100 << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int64_t inf64 = 1e18; const double eps = 1e-9; template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) { os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } void solve() { int x; double p; cin >> x >> p; p /= 100; cout << (x + 1) / 2 / p << endl; } int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); solve(); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long INF = 1e12; long long x, p; bool f(double m) { double aoki = m; double tak = (double)x + m * (1.0 - 2.0 * p / 100.0); return (tak < aoki); } signed main() { ios::sync_with_stdio(false); cin.tie(0); cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } double l = 0.0, r = 1e18; for (long long i = 0; i < 100; i++) { double mid = (l + r) / 2; if (f(mid)) r = mid; else l = mid; } printf("%.15f\n", l); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { cin >> x >> p; if (p != 100) return 0; cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; unsigned long xor128() { static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123; unsigned long t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } double dot(complex<double> a, complex<double> b) { return a.real() * b.real() + a.imag() * b.imag(); } double gyaku_dot(complex<double> a, complex<double> b) { return a.real() * b.imag() - a.imag() * b.real(); } double leng(complex<double> a) { return sqrt(a.real() * a.real() + a.imag() * a.imag()); } double angles(complex<double> a, complex<double> b) { double cosine = dot(a, b) / (leng(a) * leng(b)); double sine = gyaku_dot(a, b) / (leng(a) * leng(b)); double kaku = acos(min((double)1.0, max((double)-1.0, cosine))); if (sine <= 0) { kaku = 2 * 3.141592653589793 - kaku; } return kaku; } vector<int> convex_hull(vector<complex<double>> a) { vector<int> ans; double now_minnest = a[0].real(); int now_itr = 0; for (long long i = 0; i < a.size(); ++i) { if (now_minnest > a[i].real()) { now_minnest = a[i].real(); now_itr = i; } } ans.push_back(now_itr); complex<double> ba(0, 1); while (true) { int now_go = 0; double now_min = 0; double now_length = 0; int starter = ans[ans.size() - 1]; for (int i = 0; i < a.size(); ++i) { if (i != starter) { double goa = angles(ba, a[i] - a[starter]); if (goa - now_min >= 1e-5 || (abs(goa - now_min) <= 1e-5 && (abs(a[i] - a[starter]) - now_length) >= 1e-5)) { now_min = goa; now_go = i; now_length = abs(a[i] - a[starter]); } } } if (now_go == ans[0]) break; ans.push_back(now_go); ba = complex<double>(a[now_go] - a[starter]); } return ans; } int main() { long long x, p; cin >> x >> p; cout << fixed << setprecision(100); cout << 100.0 / (double)p * ceil(x / 2) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf("%lld", &a[j][i]); } } long long num[n]; for (int i = 0; i < n; i++) num[i] = 0; int s = 0; long long ans = 0; long long cur = 0; for (int i = 0; i < n - 1; i++) { if (a[0][i] > a[0][i + 1]) { cout << -1 << endl; return 0; } if (a[0][i] < a[0][i + 1]) { s = i + 1; cur = 0; continue; } if ((a[1][i] - a[1][i + 1]) % a[0][i] != 0) { cur = ((cur * a[0][i] + a[1][i] - a[1][i + 1]) - 1) / a[0][i] + 1; } else { int d = (a[1][i] - a[1][i + 1]) / a[0][i]; cur += d; int b1[m], b2[m]; for (int l = 0; l < m; l++) { b1[l] = a[l][i]; b2[l] = a[l][i + 1]; } if (d < 0) { for (int c = 0; c < -d; c++) { for (int l = 1; l < m; l++) { b1[l] += b1[l - 1]; } } } if (d > 0) { for (int c = 0; c < d; c++) { for (int l = 1; l < m; l++) { b2[l] += b2[l - 1]; } } } cur++; for (int l = 0; l < m; l++) { if (b1[l] < b2[l]) { cur--; break; } else if (b1[l] > b2[l]) { break; } } } cur = max(cur, 0LL); ans += cur; } cout << ans << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { scanf("%d%d", &x, &p); if (p == 100) { printf("%d\n", (x + 1) / 2); } else { printf("%f\n", x); } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> #include <vector> #include <string> #include <sstream> #include <utility> #include <set> #include <map> #include <queue> #include <stack> #include <algorithm> #include <istream> #include <ostream> #include <cstdlib> #include <cmath> #include <cstdio> using namespace std; #define fi first #define se second #define mkp make_pair #define all(x) (x).begin(), (x).end() #define pb push_back #define rep(i,n) for(ll i=0; i < (n); ++i) #define rrep(i,n) for(ll i=((n)-1); i >= 0; --i) #define OPLT(T) bool operator<(const T & lop_, const T & rop_) #define OPEQ(T) bool operator==(const T & lop_, const T & rop_) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; }; ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; }; int main() { int x, p; cin >> x >> p; cout << x/2 + x%2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <memory> #include <complex> #include <numeric> #include <cstdio> #include <iomanip> #define REP(i,m,n) for(int i=int(m);i<int(n);i++) #define EACH(i,c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) #ifdef LOCAL #define DEBUG(s) cout << (s) << endl #define dump(x) cerr << #x << " = " << (x) << endl #define BR cout << endl; #else #define DEBUG(s) do{}while(0) #define dump(x) do{}while(0) #define BR #endif using namespace std; using UI = unsigned int; using UL = unsigned long; using LL = long long int; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VLL = vector<LL>; using VS = vector<string>; using PII = pair<int,int>; using VP = vector<PII>; constexpr double EPS = 1e-10; constexpr double PI = acos(-1.0); template<class T> inline T sqr(T x) {return x*x;} int main() { int x,p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; } if (x % 2 == 1) { //cout << (1-1.0*p/100) + 1 + (x - 1) / (2.0 * p / 100) << endl; //cout << (x - 1) / (2.0 * p / 100) << endl; printf("%.08f\n", (1-1.0*p/100) + 1 + (x - 1) / (2.0 * p / 100)); } else { //cout << x / (2.0 * p / 100) << endl; printf("%.08f\n", x / (2.0 * p / 100)); } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long x, p; int main() { cin >> x >> p; if (x % 2 == 0) cout << 100.0 / p * (x / 2) << endl; else cout << 100.0 / p * ((x + 1) / 2) * (100 - p) / 100 + 100.0 / p * ((x - 1) / 2) * p / 100 + 1 << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class S, class T> istream& operator>>(istream& is, pair<S, T>& p) { return is >> p.first >> p.second; } const double EPS = 1e-10; const double PI = acos(-1.0); const long long MOD = 1e9 + 7; double C[1010][1010]; double ps[1010], qs[1010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); long long x, p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } if (x > 10) return 1; ps[0] = qs[0] = 1.; for (int i = (0); i < (1000); ++i) { ps[i + 1] = ps[i] * p / 100.; qs[i + 1] = qs[i] * (100 - p) / 100.; } for (int i = 1; i < 1000; ++i) { C[i][0] = ps[i]; C[i][i] = qs[i]; for (int j = 1; j < i; ++j) C[i][j] = C[i - 1][j] * qs[1] + C[i - 1][j - 1] * ps[1]; } vector<vector<double>> xs(2, vector<double>(1020)); int crt = 0, nxt = 1; xs[crt][510 + x] = 1.; int px = 510; double ans = 0.; for (int t = (0); t < (500); ++t) { for (int a = (1); a < (1019); ++a) xs[nxt][a] = xs[crt][a + 1] * p / 100. + xs[crt][a - 1] * (100 - p) / 100.; swap(crt, nxt); if (xs[crt][px] < EPS && xs[crt][px - 1] < EPS && xs[crt][px + 1] < EPS) ++px; else if (xs[crt][px] > xs[crt][px - 1] && xs[crt][px] > xs[crt][px + 1]) ; else if (xs[crt][px - 1] > xs[crt][px] && xs[crt][px - 1] > xs[crt][px + 1]) --px; else if (xs[crt][px + 1] > xs[crt][px - 1] && xs[crt][px + 1] > xs[crt][px]) ++px; ans += (t + 1) * xs[crt][px]; xs[crt][px] = 0.; } cout << fixed << setprecision(9) << ans << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double X; double rad; double ans; int main() { cin >> X >> rad; if ((int)X % 2 == 0) { for (int i = 0; i < 100000; i++) { ans = (ans + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } else { for (int i = 0; i < 100000; i++) { ans = (ans + 1 + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } cout << ans << "\n"; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } } star; template <typename T> inline void chmin(T &l, T r) { l = min(l, r); } template <typename T> inline void chmax(T &l, T r) { l = max(l, r); } int main() { int x; double p; cin >> x >> p; if (x > 1000) { cout << 0 << endl; return 0; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long x, p; int main() { cin >> x >> p; cout << 100.0 / p * ((x + 1) / 2) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long double X; long double rad; long double ans; int main() { cin >> X >> rad; if ((long long int)X % 2 == 0) { for (int i = 0; i < 1000; i++) { ans = (ans + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } else { for (int i = 0; i < 1000; i++) { ans = (ans + 1 + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } cout << ans << "\n"; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { cin >> x >> p; cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long x, p; cin >> x >> p; if (p != 100) { cout << "もうダメ" << endl; return 0; } cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long UNDEF = -1; const long long INF = 1e18; template <typename T> inline bool chkmax(T& aa, T bb) { return aa < bb ? aa = bb, true : false; } template <typename T> inline bool chkmin(T& aa, T bb) { return aa > bb ? aa = bb, true : false; } struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << " "; return *this; } } dbg; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10); long long b; long long inc = 0; long double p; { long long x, pp; cin >> x >> pp; if (x & 1) inc++; b = x / 2; p = (long double)pp / 100.0; } long double ans = b / p; cout << ((long double)inc) + ans << "\n"; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; x = x / 2 + x % 2; cout << x / ((double)p / 100); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007ll; const double EPS = 1e-11; double pq[2521][2521]; int main() { long long x; int _p; cin >> x >> _p; if (x % 2 == 1) x++; double p = (double)_p / 100.0; double q = 1.0 - p; pq[0][0] = 1.0; for (int i = 0; i < (int)(2520); ++i) for (int j = 0; j < (int)(2520); ++j) { pq[i + 1][j] += pq[i][j] * p; pq[i][j + 1] += pq[i][j] * q; } const int T = 100; int mn = max(0ll, x - T); double ans = 0.0; for (int y = (int)(mn); y < (int)(x); ++y) { long long tak = y; long long ao = x - y; if (tak % 2 != ao % 2) continue; if (tak < ao) continue; long long a = x / 2; long long b = (2 * y - x) / 2; ans += pq[a][b] * y; } for (int y = (int)(x); y < (int)(x + T); ++y) { if (y % 2 == 1) continue; long long a = y / 2; ans += pq[a][a] * y; } printf("%.10lf\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const int inf = 1000000009; int i, j, k, m, n, l, x, p; int ans; int main() { cin >> x >> p; if (p == 0) { cout << (x + 1) / 2 << endl; return 0; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> #include <sstream> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <memory> #include <complex> #include <numeric> #include <cstdio> #include <iomanip> #define REP(i,m,n) for(int i=int(m);i<int(n);i++) #define EACH(i,c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) #ifdef LOCAL #define DEBUG(s) cout << (s) << endl #define dump(x) cerr << #x << " = " << (x) << endl #define BR cout << endl; #else #define DEBUG(s) do{}while(0) #define dump(x) do{}while(0) #define BR #endif using namespace std; using UI = unsigned int; using UL = unsigned long; using LL = long long int; using ULL = unsigned long long; using VI = vector<int>; using VVI = vector<VI>; using VLL = vector<LL>; using VS = vector<string>; using PII = pair<int,int>; using VP = vector<PII>; constexpr double EPS = 1e-10; constexpr double PI = acos(-1.0); template<class T> inline T sqr(T x) {return x*x;} int main() { int x,p; cin >> x >> p; if (x % 2 == 1) { cout << 1.5 + (x - 1) / (2.0 * p / 100) << endl; } else { cout << x / (2.0 * p / 100) << endl; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, m; long long a[1005][1005]; int main() { ios::sync_with_stdio(0); cin.tie(); cin >> n >> m; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> a[i][j]; long long ans = 0; long long last = 0; for (int i = 1; i < n; ++i) { if (a[i - 1][0] > a[i][0]) { cout << "-1\n"; return 0; } if (a[i - 1][0] < a[i][0]) { last = 0; } else { if (n == 1) { cout << "-1\n"; return 0; } long long b = last * a[i - 1][0] + a[i - 1][1]; long long y = a[i][1]; long long x = a[i][0]; if ((b - y) % x == 0 && n > 2 && a[i][2] > a[i - 1][2]) { last = (b - y) / x; } else { long long k = max(0LL, long long(1 + floor((b - y) / long double(x)))); last = k; } } ans += last; } cout << ans << "\n"; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#{{{ header {.hints:off} import algorithm, sequtils, tables, macros, math, sets, strutils, streams when defined(MYDEBUG): import header proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.} proc getchar(): char {.header: "<stdio.h>", varargs.} proc nextInt(base:int = 0): int = scanf("%lld",addr result) result -= base proc nextFloat(): float = scanf("%lf",addr result) proc nextString(): string = var get = false;result = "" while true: var c = getchar() if int(c) > int(' '): get = true;result.add(c) elif get: break template `max=`*(x,y:typed):void = x = max(x,y) template `min=`*(x,y:typed):void = x = min(x,y) template infty(T): untyped = ((T(1) shl T(sizeof(T)*8-2)) - 1) #}}} proc solve(x:int, p:int) = var fp = float(p)/100.0 proc calc(x:int):float = assert x mod 2 == 0 return float(x)/(2.0*fp) var ans = 0.0 if x mod 2 == 0: ans = calc(x) else: ans =calc(x-1)*fp + calc(x+1)*(1.0-fp) echo ans.formatFloat(ffDecimal,20) return #{{{ main function proc main() = var x = 0 x = nextInt() var p = 0 p = nextInt() solve(x, p); return main() #}}}
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; assert(p == 100); cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int x, p; int main(void) { scanf("%d%d", &x, &p); int ans = x / 2; if (ans % 2 == 1) { ans++; } if (ans == 0) { ans = 1; } printf("%d\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class S, class T> istream& operator>>(istream& is, pair<S, T>& p) { return is >> p.first >> p.second; } const double EPS = 1e-10; const double PI = acos(-1.0); const long long MOD = 1e9 + 7; double C[1010][1010]; double ps[1010], qs[1010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); long long x, p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } if (x > 10) return 1; ps[0] = qs[0] = 1.; for (int i = (0); i < (1000); ++i) { ps[i + 1] = ps[i] * p / 100.; qs[i + 1] = qs[i] * (100 - p) / 100.; } for (int i = 1; i < 1000; ++i) { C[i][0] = ps[i]; C[i][i] = qs[i]; for (int j = 1; j < i; ++j) C[i][j] = C[i - 1][j] * qs[1] + C[i - 1][j - 1] * ps[1]; } vector<vector<double>> xs(2, vector<double>(2020)); int crt = 0, nxt = 1; xs[crt][510 + x] = 1.; int px = 510; double ans = 0.; for (int t = (0); t < (1000); ++t) { for (int a = (1); a < (2019); ++a) xs[nxt][a] = xs[crt][a + 1] * p / 100. + xs[crt][a - 1] * (100 - p) / 100.; swap(crt, nxt); if (xs[crt][px] < EPS && xs[crt][px - 1] < EPS && xs[crt][px + 1] < EPS) ++px; else if (xs[crt][px] > xs[crt][px - 1] && xs[crt][px] > xs[crt][px + 1]) ; else if (xs[crt][px - 1] > xs[crt][px] && xs[crt][px - 1] > xs[crt][px + 1]) --px; else if (xs[crt][px + 1] > xs[crt][px - 1] && xs[crt][px + 1] > xs[crt][px]) ++px; ans += (t + 1) * xs[crt][px]; xs[crt][px] = 0.; } cout << fixed << setprecision(9) << ans << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double f(int p, int n) { double P = p / 100.0; double Q = 1.0 - P; double ans = pow(P, n / 2) * pow(1 - Q, -n / 2) * (-n) / (2 * (Q - 1)); return ans; } int main() { int x, p; cin >> x >> p; cout.precision(10); double ans; if (x % 2) ans = 1.0 + (p / 100.0) * f(p, x - 1) + ((100 - p) / 100.0) * f(p, x + 1); else ans = f(p, x); cout << fixed << ans << "\n"; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; template <typename T> using pair2 = pair<T, T>; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; } template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); } clock_t startTime; double getCurrentTime() { return (double)(clock() - startTime) / CLOCKS_PER_SEC; } const ll INF = (ll)1e18; ll MOD; ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; } ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; } ll mul(ll x, ll y) { return (x * y) % MOD; } ll bin_pow(ll x, ll p) { if (p == 0) return 1; if (p & 1) return mul(x, bin_pow(x, p - 1)); return bin_pow(mul(x, x), p / 2); } const int N = 2000100; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); startTime = clock(); ld p, ans = 0; ll x; cin >> x >> p; p /= 100; if (x % 2 == 0) { ans = 1.0 * x / 2 * p; } else { ans = 1.0 + (x + 1) / 2 * (1.0 - p) / p + (x - 1) / 2; } cout << setprecision(10) << ans << '\n'; ; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long x, p; int main() { cin >> x >> p; if (p == 100) { if (x % 2 == 0) { cout << x / 2 << endl; } else { cout << x / 2 + 1 << endl; } return 0; } printf("%.20f\n", 100 * (double)x / (100 - (double)p) / 2.0); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100005; int main() { cin.tie(0); ios::sync_with_stdio(false); int x, p; cin >> x >> p; if (p == 100) { printf("%.12lf\n", (double)(x + 1) / 2); return 0; } printf("%.12lf\n", 100.0 * ((x + 1) / 2) / p); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double f(long long x, double p) { return double(x) / p * 100; } int main() { long long x; double p; cin >> x >> p; if (x % 2 == 0) { x /= 2; cout << f(x, p) << endl; } else { long long y = x / 2; x = y + 1; cout << 1 + (f(x, p) * (100 - p) / 100 + f(y, p) * p / 100) << endl; } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long INF = 1e12; signed main() { ios::sync_with_stdio(false); cin.tie(0); long long x, p; cin >> x >> p; assert(p == 100); cout << (x + 1) / 2 << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(){ long long x; double p; cin>>x>>p; if(x%2){cout<<setprecision(20)<<((double)x+1)/2/p*100)<<endl;} else{ cout<<setprecision(20)<<((double)x)/2/p*100)<<endl;} }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e18; const ll MOD = 1e9 + 7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int K; string S; int main() { cin >> K >> S; if (K == 0) cout << S << endl; else if (K <= 2) { if (S.size() == 1) cout << S << endl; else cout << max(S[0], S[1]) << endl; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int TT = X/2; if(X%2 == 1) TT++; if(P == 100){ Console.WriteLine("{0}",(double)TT);return; } Console.WriteLine(0); } int X,P; public Sol(){ X = ri(); P = ri(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007ll; const double EPS = 1e-11; const int C = 100000; double perc[2][252521]; int main() { long long x; int _p; cin >> x >> _p; double p = (double)_p / 100.0; double q = 1.0 - p; int cur = 0; perc[cur][x + C] = 1.0; int pos = C; cur ^= 1; double ans = 0.0; for (int t = 0; t < (int)(100000); ++t) { for (int i = 0; i < (int)(252521); ++i) perc[cur][i] = 0.0; for (int i = 0; i < (int)(252521); ++i) { if (i > 0) perc[cur][i - 1] += perc[cur ^ 1][i] * p; if (i < 252520) perc[cur][i + 1] += perc[cur ^ 1][i] * q; } int mxp = -1; double mxv = -1.0; if (perc[cur][pos + 1] > mxv) { mxv = perc[cur][pos + 1]; mxp = pos + 1; } if (perc[cur][pos] > mxv) { mxv = perc[cur][pos]; mxp = pos; } if (perc[cur][pos - 1] > mxv) { mxv = perc[cur][pos - 1]; mxp = pos - 1; } pos = mxp; ans += (double)(t + 1) * perc[cur][mxp]; perc[cur][mxp] = 0.0; cur ^= 1; } printf("%.9lf\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = std::int_fast64_t; using ld = long double; using P = pair<ll, ll>; constexpr ll inf = 1000000000; constexpr ll mod = 1000000007; constexpr long double eps = 1e-15; template <typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1, T2> p) { os << to_string(p.first) << " " << to_string(p.second); return os; } template <typename T> ostream& operator<<(ostream& os, vector<T>& v) { for (int i = 0; i < (int)v.size(); i++) { if (i) os << " "; os << to_string(v[i]); } return os; } int main() { cin.tie(0); ios::sync_with_stdio(false); int x, p; cin >> x >> p; ld ans = 0; if (x % 2) { ans += 1; ans += p / (ld)100 * (100 / (ld)p * ((x - 1) / 2)) + (p - 100) / (ld)100 * (100 / (ld)p * ((x + 1) / 2)); } else { ans = 100 / (ld)p * (x / 2); } cout << fixed << setprecision(39) << ans << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; int a; float r; std::cin >> x >> p; if (x % 2 == 0) { a = 0; } else { a = -1; } if (p == 100) { r = (x - a) / 2; std::cout << r << std::endl; } else { std::cout << "(´・ω・`)" << std::endl; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int X; double p; double calc(int x) { double ret = 0; double pp = 1, np = 1; for (int i = 0; i < x / 2; i++) pp *= p; double comb = 1; for (int tm = 0; tm < 1e6; tm++) { long k = x / 2 + tm; ret += k * pp * np * comb; np *= 1 - p; comb *= k; comb /= k - x / 2 + 1; } return ret; } int main() { cin >> X >> p; p /= 100; double ans; if (X % 2 == 0) ans = calc(X); else ans = p * calc(X - 1) + (1 - p) * calc(X + 1) + 1; cout << fixed << setprecision(16) << ans << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; int main() { long long x, p; std::cin >> x >> p; x++; if (x % 2 == 0) std::cout << x / 2 << ".00000000" << std::endl; else std::cout << x / 2 + 1 << std::endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 300; map<tuple<int, int, int>, double> dp; double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } int res = abs(pos_ao - pos_cho); if (res > 20) return INF; if (turn >= MAX_TURN) { return INF; } double pro = (double)P / 100; if (dp.count(make_tuple(turn, pos_ao, pos_cho)) > 0) { return dp[make_tuple(turn, pos_ao, pos_cho)]; } double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); dp[make_tuple(turn, pos_ao, pos_cho)] = result; return result; } int main() { cin >> X >> P; if (X > 10) return 0; double result = memo(0, 0, X); printf("%.20lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
say 100*(get+1>>1)/get
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; int main() { long long x, p; std::cin >> x >> p; x++; if (x % 2 == 0) std::cout << x / 2 << std::endl; else std::cout << x / 2 << ".5" << std::endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; signed long long X; double P; void solve() { int i, j, k, l, r, x, y; string s; cin >> X >> P; if (P != 100) return; P /= 100; (void)printf("%lld\n", (X + 1) / 2); } int main(int argc, char** argv) { string s; int i; if (argc == 1) ios::sync_with_stdio(false), cin.tie(0); for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n'; for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin); solve(); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; cout.precision(10); if (p == 100) cout << (x / 2) + (x % 2) << ".000000\n"; else { double P = p / 100.0; double Q = 1.0 - P; double ans = pow(P, x / 2) * (-2 * x * Q + 2 * x + 12 * Q); ans /= 4; ans /= pow(P, 4); cout << fixed << ans << "\n"; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } vector<double> dp(1000); dp[x - 1] = 1; double out = 0; for (int i = 0; i < 1000; i++) { vector<double> ndp(1000); for (int j = i + 1; j < 1000; j++) { if (j) ndp[j - 1] += dp[j] * p / 100; else out += dp[0] * p / 100; if (j != 999) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 1; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const long double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 2000; const int MAX_POS = 100; long double dp[MAX_TURN][MAX_POS][MAX_POS]; bool visited[MAX_TURN][MAX_POS][MAX_POS]; long double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } if (turn >= MAX_TURN or pos_ao < 0 or pos_ao >= MAX_POS or pos_cho < 0 or pos_cho >= MAX_POS) { return INF; } long double pro = (long double)P / 100; if (visited[turn][pos_ao][pos_cho]) { return dp[turn][pos_ao][pos_cho]; } visited[turn][pos_ao][pos_cho] = true; long double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); return dp[turn][pos_ao][pos_cho] = result; } int main() { cin >> X >> P; if (X > 10) return 0; int geta = MAX_POS / 2; long double result = memo(0, geta, X + geta); printf("%.20Lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long long x; double p; int main() { cin >> x >> p; if (p == 100) { if (x % 2 == 0) { cout << x / 2 << endl; } else { cout << x / 2 + 1 << endl; } return 0; } if (x > 10) { return 1; } vector<double> dp(15, 0); long long turn = 0; if (x % 2 == 1) { dp[x - 1] = 1.0 * p / 100.0; dp[x + 1] = 1.0 * (100.0 - p) / 100.0; turn++; } else { dp[x] = 1; } double ans = 0; for (int i = 0; i < 10000; i++) { ans += turn * dp[0]; dp[0] = 0; turn++; vector<double> dp2(15, 0); for (int j = 0; j < 13; j++) { if (j > 1) { dp2[j - 2] += dp[j] * p / 100.0; } dp2[j] = dp[j] * (100.0 - p) / 100.0; } dp = dp2; } printf("%.20f\n", ans); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } vector<double> dp(1000); dp[x - 1] = 1; double out = 0; for (int i = 0; i < 1000; i++) { vector<double> ndp(1000); for (int j = i + 1; j < 1000; j++) { if (j) ndp[j - 1] += dp[j] * p / 100; if (j != 999) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 1; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } vector<double> dp(1000); dp[x - 1] = 1; double out = 0; for (int i = 0; i < 1000; i++) { vector<double> ndp(1000); for (int j = i; j < 1000; j++) { if (j) ndp[j - 1] += dp[j] * p / 100; else out += dp[0] * p / 100; if (j != 999) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 1; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int inf = numeric_limits<int>::max() / 2; int dp[100100]; int main(void) { int x, p; cin >> x >> p; fill(dp, dp + 100100, -1); if (p != 100) { return 0; } cout << setprecision(15) << ceil(x / 2.0) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; unsigned long xor128() { static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123; unsigned long t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } double dot(complex<double> a, complex<double> b) { return a.real() * b.real() + a.imag() * b.imag(); } double gyaku_dot(complex<double> a, complex<double> b) { return a.real() * b.imag() - a.imag() * b.real(); } double leng(complex<double> a) { return sqrt(a.real() * a.real() + a.imag() * a.imag()); } double angles(complex<double> a, complex<double> b) { double cosine = dot(a, b) / (leng(a) * leng(b)); double sine = gyaku_dot(a, b) / (leng(a) * leng(b)); double kaku = acos(min((double)1.0, max((double)-1.0, cosine))); if (sine <= 0) { kaku = 2 * 3.141592653589793 - kaku; } return kaku; } vector<int> convex_hull(vector<complex<double>> a) { vector<int> ans; double now_minnest = a[0].real(); int now_itr = 0; for (long long i = 0; i < a.size(); ++i) { if (now_minnest > a[i].real()) { now_minnest = a[i].real(); now_itr = i; } } ans.push_back(now_itr); complex<double> ba(0, 1); while (true) { int now_go = 0; double now_min = 0; double now_length = 0; int starter = ans[ans.size() - 1]; for (int i = 0; i < a.size(); ++i) { if (i != starter) { double goa = angles(ba, a[i] - a[starter]); if (goa - now_min >= 1e-5 || (abs(goa - now_min) <= 1e-5 && (abs(a[i] - a[starter]) - now_length) >= 1e-5)) { now_min = goa; now_go = i; now_length = abs(a[i] - a[starter]); } } } if (now_go == ans[0]) break; ans.push_back(now_go); ba = complex<double>(a[now_go] - a[starter]); } return ans; } int main() { long long x, p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2LL << endl; return 0; } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
/+ dub.sdl: name "A" dependency "dcomp" version=">=0.6.0" +/ import std.stdio, std.algorithm, std.range, std.conv; import std.typecons; import std.bigint; // import dcomp.foundation, dcomp.scanner; // import dcomp.container.deque; int main() { auto sc = new Scanner(stdin); int n, m, k; sc.read(n, m, k); m++; int[] a = new int[n]; a.each!((ref x) => sc.read(x)); long[] dp = a.map!(to!long).array; long[] ndp = new long[n]; auto deq = Deque!(int, false).make(); auto p = deq.p; foreach (int ph; 2..k+1) { ndp[] = -(10L^^18); deq.clear(); foreach (int i; 0..n) { if (deq.length && deq[0] == i-m) { p.removeFront(); } if (deq.length) { ndp[i] = dp[deq[0]] + 1L * ph * a[i]; } while (deq.length && dp[deq[p.length-1]] <= dp[i]) { p.removeBack(); } p.insertBack(i); } swap(dp, ndp); } writeln(dp.fold!max); return 0; } /* IMPORT /home/yosupo/Program/dcomp/source/dcomp/foundation.d */ // module dcomp.foundation; //fold(for old compiler) static if (__VERSION__ <= 2070) { template fold(fun...) if (fun.length >= 1) { auto fold(R, S...)(R r, S seed) { import std.algorithm : reduce; static if (S.length < 2) { return reduce!fun(seed, r); } else { import std.typecons : tuple; return reduce!fun(tuple(seed), r); } } } unittest { import std.stdio; auto l = [1, 2, 3, 4, 5]; assert(l.fold!"a+b"(10) == 25); } } version (X86) static if (__VERSION__ < 2071) { int bsf(ulong v) { foreach (i; 0..64) { if (v & (1UL << i)) return i; } return -1; } int bsr(ulong v) { foreach_reverse (i; 0..64) { if (v & (1UL << i)) return i; } return -1; } int popcnt(ulong v) { int c = 0; foreach (i; 0..64) { if (v & (1UL << i)) c++; } return c; } } /* IMPORT /home/yosupo/Program/dcomp/source/dcomp/container/deque.d */ // module dcomp.container.deque; struct Deque(T, bool hasNull = true) { import core.exception : RangeError; import core.memory : GC; import std.range : ElementType, isInputRange; import std.traits : isImplicitlyConvertible; struct Payload { T *d; size_t st, length, cap; @property bool empty() const { return length == 0; } alias opDollar = length; ref inout(T) opIndex(size_t i) inout { version(assert) if (length <= i) throw new RangeError(); return d[(st+i >= cap) ? (st+i-cap) : st+i]; } private void expand() { import std.algorithm : max; assert(length == cap); auto nc = max(size_t(4), 2*cap); T* nd = cast(T*)GC.malloc(nc * T.sizeof); foreach (i; 0..length) { nd[i] = this[i]; } d = nd; st = 0; cap = nc; } void clear() { st = length = 0; } void insertFront(T v) { if (length == cap) expand(); if (st == 0) st += cap; st--; length++; this[0] = v; } void insertBack(T v) { if (length == cap) expand(); length++; this[length-1] = v; } void removeFront() { assert(!empty, "Deque.removeFront: Deque is empty"); st++; length--; if (st == cap) st = 0; } void removeBack() { assert(!empty, "Deque.removeBack: Deque is empty"); length--; } } struct RangeT(A) { alias T = typeof(*(A.p)); alias E = typeof(A.p.d[0]); T *p; size_t a, b; @property bool empty() const { return b <= a; } @property size_t length() const { return b-a; } @property RangeT save() { return RangeT(p, a, b); } @property RangeT!(const A) save() const { return typeof(return)(p, a, b); } alias opDollar = length; @property ref inout(E) front() inout { return (*p)[a]; } @property ref inout(E) back() inout { return (*p)[b-1]; } void popFront() { version(assert) if (empty) throw new RangeError(); a++; } void popBack() { version(assert) if (empty) throw new RangeError(); b--; } ref inout(E) opIndex(size_t i) inout { return (*p)[i]; } RangeT opSlice() { return this.save; } RangeT opSlice(size_t i, size_t j) { version(assert) if (i > j || a + j > b) throw new RangeError(); return typeof(return)(p, a+i, a+j); } RangeT!(const A) opSlice() const { return this.save; } RangeT!(const A) opSlice(size_t i, size_t j) const { version(assert) if (i > j || a + j > b) throw new RangeError(); return typeof(return)(p, a+i, a+j); } } alias Range = RangeT!Deque; alias ConstRange = RangeT!(const Deque); alias ImmutableRange = RangeT!(immutable Deque); Payload *p; private void I() { if (hasNull && !p) p = new Payload(); } private void C() const { version(assert) if (hasNull && !p) throw new RangeError(); } //some value this(U)(U[] values...) if (isImplicitlyConvertible!(U, T)) {I; p = new Payload(); foreach (v; values) { insertBack(v); } } //range this(Range)(Range r) if (isInputRange!Range && isImplicitlyConvertible!(ElementType!Range, T) && !is(Range == T[])) {I; p = new Payload(); foreach (v; r) { insertBack(v); } } static Deque make() { Deque que; que.p = new Payload(); return que; } @property private bool hasPayload() const { return (!hasNull || p); } @property bool empty() const { return (!hasPayload || p.empty); } @property size_t length() const { return (hasPayload ? p.length : 0); } alias opDollar = length; ref inout(T) opIndex(size_t i) inout {C; return (*p)[i]; } ref inout(T) front() inout {C; return (*p)[0]; } ref inout(T) back() inout {C; return (*p)[$-1]; } void clear() { if (p) p.clear(); } void insertFront(T v) {I; p.insertFront(v); } void insertBack(T v) {I; p.insertBack(v); } void removeFront() {C; p.removeFront(); } void removeBack() {C; p.removeBack(); } Range opSlice() {I; return Range(p, 0, length); } } unittest { import std.algorithm : equal; import std.range.primitives : isRandomAccessRange; import std.container.util : make; auto q = make!(Deque!int); assert(isRandomAccessRange!(typeof(q[]))); //insert,remove assert(equal(q[], new int[](0))); q.insertBack(1); assert(equal(q[], [1])); q.insertBack(2); assert(equal(q[], [1, 2])); q.insertFront(3); assert(equal(q[], [3, 1, 2]) && q.front == 3); q.removeFront; assert(equal(q[], [1, 2]) && q.length == 2); q.insertBack(4); assert(equal(q[], [1, 2, 4]) && q.front == 1 && q.back == 4 && q[$-1] == 4); q.insertFront(5); assert(equal(q[], [5, 1, 2, 4])); //range assert(equal(q[][1..3], [1, 2])); assert(equal(q[][][][], q[])); //const range const auto rng = q[]; assert(rng.front == 5 && rng.back == 4); //reference type auto q2 = q; q2.insertBack(6); q2.insertFront(7); assert(equal(q[], q2[]) && q.length == q2.length); //construct with make auto a = make!(Deque!int)(1, 2, 3); auto b = make!(Deque!int)([1, 2, 3]); assert(equal(a[], b[])); } unittest { import std.algorithm : equal; import std.range.primitives : isRandomAccessRange; import std.container.util : make; auto q = make!(Deque!int); q.clear(); assert(equal(q[], new int[0])); foreach (i; 0..100) { q.insertBack(1); q.insertBack(2); q.insertBack(3); q.insertBack(4); q.insertBack(5); assert(equal(q[], [1,2,3,4,5])); q.clear(); assert(equal(q[], new int[0])); } } unittest { Deque!int a; Deque!int b; a.insertFront(2); assert(b.length == 0); } unittest { import std.algorithm : equal; import std.range : iota; Deque!int a; foreach (i; 0..100) { a.insertBack(i); } assert(equal(a[], iota(100))); } /* IMPORT /home/yosupo/Program/dcomp/source/dcomp/scanner.d */ // module dcomp.scanner; class Scanner { import std.stdio : File; import std.conv : to; import std.range : front, popFront, array, ElementType; import std.array : split; import std.traits : isSomeChar, isStaticArray, isArray; import std.algorithm : map; File f; this(File f) { this.f = f; } char[512] lineBuf; char[] line; private bool succ() { import std.range.primitives : empty, front, popFront; import std.ascii : isWhite; while (true) { while (!line.empty && line.front.isWhite) { line.popFront; } if (!line.empty) break; if (f.eof) return false; line = lineBuf[]; f.readln(line); } return true; } private bool readSingle(T)(ref T x) { import std.algorithm : findSplitBefore; import std.string : strip; import std.conv : parse; if (!succ()) return false; static if (isArray!T) { alias E = ElementType!T; static if (isSomeChar!E) { //string or char[10] etc //todo optimize auto r = line.findSplitBefore(" "); x = r[0].strip.dup; line = r[1]; } else { auto buf = line.split.map!(to!E).array; static if (isStaticArray!T) { //static assert(buf.length == T.length); } x = buf; line.length = 0; } } else { x = line.parse!T; } return true; } int read(T, Args...)(ref T x, auto ref Args args) { if (!readSingle(x)) return 0; static if (args.length == 0) { return 1; } else { return 1 + read(args); } } } unittest { import std.path : buildPath; import std.file : tempDir; import std.algorithm : equal; import std.stdio : File; string fileName = buildPath(tempDir, "kyuridenanmaida.txt"); auto fout = File(fileName, "w"); fout.writeln("1 2 3"); fout.writeln("ab cde"); fout.writeln("1.0 1.0 2.0"); fout.close; Scanner sc = new Scanner(File(fileName, "r")); int a; int[2] b; char[2] c; string d; double e; double[] f; sc.read(a, b, c, d, e, f); assert(a == 1); assert(equal(b[], [2, 3])); assert(equal(c[], "ab")); assert(equal(d, "cde")); assert(e == 1.0); assert(equal(f, [1.0, 2.0])); } unittest { import std.path : buildPath; import std.file : tempDir; import std.algorithm : equal; import std.stdio : File, writeln; import std.datetime; string fileName = buildPath(tempDir, "kyuridenanmaida.txt"); auto fout = File(fileName, "w"); foreach (i; 0..1_000_000) { fout.writeln(3*i, " ", 3*i+1, " ", 3*i+2); } fout.close; writeln("Scanner Speed Test(3*1,000,000 int)"); StopWatch sw; sw.start; Scanner sc = new Scanner(File(fileName, "r")); foreach (i; 0..500_000) { int a, b, c; sc.read(a, b, c); assert(a == 3*i); assert(b == 3*i+1); assert(c == 3*i+2); } foreach (i; 500_000..700_000) { int[3] d; sc.read(d); int a = d[0], b = d[1], c = d[2]; assert(a == 3*i); assert(b == 3*i+1); assert(c == 3*i+2); } foreach (i; 700_000..1_000_000) { int[] d; sc.read(d); assert(d.length == 3); int a = d[0], b = d[1], c = d[2]; assert(a == 3*i); assert(b == 3*i+1); assert(c == 3*i+2); } writeln(sw.peek.msecs, "ms"); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; double X; double P; int main() { cin >> X >> P; cout << 50.0 * (X + ((int)X % 2)) / P << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e9; const ll MOD = 1e9 + 7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int x, p; cin >> x >> p; cout << (x + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long double X; long double rad; long double ans; int main() { cin >> X >> rad; if ((long long int)X % 2 == 0) { for (int i = 0; i < 10000000; i++) { ans = (ans + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } else { for (int i = 0; i < 10000000; i++) { ans = (ans + 1 + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } printf("%lf\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int f(int x, int y) { int r; for (int i = x; i > y; i--) { r *= i; } return r; } int main() { int x, p; int a; float r; std::cin >> x >> p; if (x % 2 == 0) { a = 0; } else { a = -1; } if (p == 100) { r = (x - a) / 2; std::cout << r << std::endl; return 0; } std::cout << "(´・ω・`)" << std::endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 1000; const int MAX_POS = 100; double dp[MAX_TURN][MAX_POS][MAX_POS]; bool visited[MAX_TURN][MAX_POS][MAX_POS]; double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } if (turn >= MAX_TURN or pos_ao < 0 or pos_ao >= MAX_POS or pos_cho < 0 or pos_cho >= MAX_POS) { return INF; } double pro = (double)P / 100; if (visited[turn][pos_ao][pos_cho]) { return dp[turn][pos_ao][pos_cho]; } visited[turn][pos_ao][pos_cho] = true; double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); return dp[turn][pos_ao][pos_cho] = result; } int main() { cin >> X >> P; if (X > 10) return 0; int geta = MAX_POS / 2; double result = memo(0, geta, X + geta); printf("%.20lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll,ll> ii; typedef vector<int> vi; typedef long double ld; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll x; int p; cin>>x>>p; ld ans = 0; cout<<(x+1)/2; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007ll; const double EPS = 1e-11; const int C = 1000; double perc[2][2521]; int main() { long long x; int _p; cin >> x >> _p; double p = (double)_p / 100.0; double q = 1.0 - p; int cur = 0; perc[cur][x + C] = 1.0; int pos = C; cur ^= 1; double ans = 0.0; for (int t = 0; t < (int)(1000); ++t) { for (int i = 0; i < (int)(2521); ++i) perc[cur][i] = 0.0; for (int i = 0; i < (int)(2521); ++i) { if (i > 0) perc[cur][i - 1] += perc[cur ^ 1][i] * p; if (i < 2520) perc[cur][i + 1] += perc[cur ^ 1][i] * q; } int mxp = -1; double mxv = -1.0; if (perc[cur][pos + 1] > mxv) { mxv = perc[cur][pos + 1]; mxp = pos + 1; } if (perc[cur][pos] > mxv) { mxv = perc[cur][pos]; mxp = pos; } if (perc[cur][pos - 1] > mxv) { mxv = perc[cur][pos - 1]; mxp = pos - 1; } pos = mxp; ans += (double)(t + 1) * perc[cur][mxp]; perc[cur][mxp] = 0.0; cur ^= 1; } printf("%.9lf\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e9; const ll MOD = 1e9 + 7; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { int x, p; cin >> x >> p; cout << x - 1 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class Main { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static boolean debug = false; static void solve() { int x = in.nextInt(); int p = in.nextInt(); if (p != 100) { return; } if (x%2 == 0) { out.println(x/2); } else { out.println((x/2 + 1)); } } public static void main(String[] args) { debug = args.length > 0; long start = System.nanoTime(); solve(); out.flush(); long end = System.nanoTime(); dump((end - start) / 1000000 + " ms"); in.close(); out.close(); } static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; if (p == 100) { int tim = (x + 1) / 2; cout << tim << endl; } double pp = p / 100.0; if (x % 2) { printf("%.14f\n", ((double)(1 - pp) / pp + (double)x / pp) / 2.0); } else printf("%.14f\n", ((double)x / pp) / 2.0); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
print<>*50/<>#に近い値
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using LONG = long long int; using ULONG = unsigned long long int; int main(void) { int x, p; cin >> x >> p; if (p != 100) return 0; cout << ((x + 1) / 2) << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; long double X; long double rad; long double ans; int main() { cin >> X >> rad; if ((long long int)X % 2 == 0) { for (int i = 0; i < 10000000; i++) { ans = (ans + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } else { for (int i = 0; i < 10000000; i++) { ans = (ans + 1 + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } cout << ans << "\n"; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long x, p; cin >> x >> p; x = (x + 1) / 2 * 100; cout << x / (double)p << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = 2 * acos(0.0); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const string DIGITS = "0123456789"; const string ALPH = "abcdefghijklmnopqrstuvwxyz"; template <class T0, class T1> inline ostream &operator<<(ostream &out, pair<T0, T1> &a) { return out << "{" << a.first << ", " << a.second << "}"; } template <class T0, class T1> inline istream &operator>>(istream &in, pair<T0, T1> &a) { return in >> a.first >> a.second; } template <class T0, class T1, class T2> inline ostream &operator<<(ostream &out, tuple<T0, T1, T2> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}"; } template <class T0, class T1, class T2, class T3> inline ostream &operator<<(ostream &out, tuple<T0, T1, T2, T3> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}"; } template <class T> inline ostream &operator<<(ostream &out, vector<T> &a) { out << "["; for (int i = 0; i < int(a.size()); ++i) out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()]; return out; } void smain(); signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(12) << fixed; smain(); return 0; } const int MOD = 1e9 + 7, N = 1e5 + 1, M = 4e5 + 100, oo = 1e9; void smain() { int x, p; cin >> x >> p; cout << (long double)((x / 2 + x % 2) * 100) / p; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
python2
x = int(raw_input()) p = int(raw_input()) if p==100: print x/2 + x%2
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> #include <iomanip> using namespace std; double p int x; int main(){ cin >> x >> p; if(x%2==1) x++; cout << setprecision(8) << x/(2*p) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
x,$0=int(++x/2)*100/$0;{x=$0}
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
python3
#include <bits/stdc++.h> using namespace std; int main() { long long x; double p; cin >> x >> p; if (x % 2) { cout << setprecision(20) << (((double)x + 1) / 2) / p * 100 << endl; } else { cout << setprecision(20) << (((double)x) / 2) / p * 100 << endl; } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <iostream> using namespace std; double p,x; int main(){ cin >> x >> p; if(x%2==1) x++; cout << setprecision(8) << x/(2*p) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf("%lld", &a[j][i]); } } long long num[n]; for (int i = 0; i < n; i++) num[i] = 0; int s = 0; long long ans = 0; long long cur = 0; for (int i = 0; i < n - 1; i++) { if (a[0][i] > a[0][i + 1]) { cout << -1 << endl; return 0; } if (a[0][i] < a[0][i + 1]) { s = i + 1; cur = 0; continue; } if ((a[1][i] - a[1][i + 1]) % a[0][i] != 0) { cur = ((cur * a[0][i] + a[1][i] - a[1][i + 1]) - 1) / a[0][i] + 1; } else { int d = (a[1][i] - a[1][i + 1]) / a[0][i]; cur += d; long long b1[m], b2[m]; for (int l = 0; l < m; l++) { b1[l] = a[l][i]; b2[l] = a[l][i + 1]; } if (d < 0) { for (int c = 0; c < -d; c++) { for (int l = 1; l < m; l++) { b1[l] += b1[l - 1]; } } } if (d > 0) { for (int c = 0; c < d; c++) { for (int l = 1; l < m; l++) { b2[l] += b2[l - 1]; } } } cur++; for (int l = 0; l < m; l++) { if (b1[l] < b2[l]) { cur--; break; } else if (b1[l] > b2[l]) { break; } } } cur = max(cur, 0LL); ans += cur; } cout << ans << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { private static void solve() { long x = nel(); int p = nei(); if (p < 100) { out(114514); return; } if (x % 2 == 0) { out(x >> 1); return; } out(x + 1 >> 1); } static int abs(int x) { return x < 0 ? -x : x; } static long abs(long x) { return x < 0 ? -x : x; } static int min(int a, int b) { return a < b ? a : b; } static long min(long a, long b) { return a < b ? a : b; } static int max(int a, int b) { return a > b ? a : b; } static long max(long a, long b) { return a > b ? a : b; } static int clamp(int a, int min, int max) { return a < min ? min : a > max ? max : a; } static long clamp(long a, long min, long max) { return a < min ? min : a > max ? max : a; } static void out(String val) { IO.out(val); } static void out(Object val) { IO.out(String.valueOf(val)); } static void out(int val) { IO.out(String.valueOf(val)); } static void out(long val) { IO.out(String.valueOf(val)); } static void out(char val) { IO.out(String.valueOf(val)); } static void out(float val) { IO.out(String.valueOf(val)); } static void out(double val) { IO.out(String.valueOf(val)); } static void out(boolean val) { IO.out(String.valueOf(val)); } static String nes() { return IO.next(); } static int nei() { return IO.nextInt(); } static long nel() { return IO.nextLong(); } static int parseInt(String val) { return Integer.parseInt(val); } static int parseInt(char val) { return Integer.parseInt(String.valueOf(val)); } static long parseLong(String val) { return Long.parseLong(val); } public static void main(String[] args) { solve(); IO.flush(); } } final class IO { private static final InputStream in = System.in; private static final PrintWriter out = new PrintWriter(System.out, false); private static final byte[] buffer = new byte[1024]; private static int ptr = 0; private static int len = 0; private static boolean hasNextByte() { if (ptr < len) return true; ptr = 0; try { len = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } return len > 0; } private static int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } static boolean hasNext() { byte c; while (hasNextByte() && ((c = buffer[ptr]) < '!' || c > '~')) ptr++; return hasNextByte(); } static String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (b >= '!' && b <= '~') { sb.append((char) b); b = readByte(); } return sb.toString(); } static long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; int sign = 1; int b = readByte(); if (b == '-') { sign = -1; b = readByte(); } if (b < '0' || '9' < b) throw new NumberFormatException(); while (true) { if ('0' <= b && b <= '9') n = n * 10 + b - '0'; else if (b == -1 || b < '!' || b > '~') return n * sign; else throw new NumberFormatException(); b = readByte(); } } static int nextInt() { if (!hasNext()) throw new NoSuchElementException(); int n = 0; int sign = 1; int b = readByte(); if (b == '-') { sign = -1; b = readByte(); } if (b < '0' || '9' < b) throw new NumberFormatException(); while (true) { if ('0' <= b && b <= '9') n = n * 10 + b - '0'; else if (b == -1 || b < '!' || b > '~') return n * sign; else throw new NumberFormatException(); b = readByte(); } } static void out(String val) { out.println(val); } static void flush() { out.flush(); } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
say 100*(get+1+>1)/get
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int TT = X/2; if(X%2 == 1) TT++; if(P == 100){ Console.WriteLine("{0}",(double)TT); } Console.WriteLine(0); } int X,P; public Sol(){ X = ri(); P = ri(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const int inf = 1000000009; int i, j, k, m, n, l; long long ans; long long a[400][400], b[400]; const int U = 4000; long long C[U][U]; int good(int i) { for (int j = 1; j <= m; j++) if (a[i][j] < a[i + 1][j]) return 1; else if (a[i][j] > a[i + 1][j]) return 0; return 0; } void doit(int i, int t) { for (int j = 1; j <= m; j++) b[j] = a[i][j]; ans += t; for (int j = 1; j <= m; j++) { a[i][j] = 0; for (int k = 1; k <= j; k++) { int u = j - k; a[i][j] += b[k] * C[t + u - 1][u]; } } } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; for (int i = 0; i < U; i++) { C[i][0] = C[i][i] = 1; for (int j = 1; j <= i - 1; j++) C[i][j] = C[i - 1][j] + C[i - 1][j - 1]; } for (int i = 1; i <= n - 1; i++) if (a[i][1] > a[i + 1][1]) { cout << -1 << endl; exit(0); } for (int i = 1; i <= n - 1; i++) { if (a[i][2] < a[i + 1][2]) continue; if (a[i][2] > a[i + 1][2]) { doit(i + 1, (a[i][2] - a[i + 1][2] + a[i][1] - 1) / a[i][1]); } if (!good(i)) { doit(i + 1, 1); } } cout << ans << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int n, p; int main() { cin >> n >> p; cout << (n + 1) / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 2000; const int MAX_POS = 100; double dp[MAX_TURN][MAX_POS][MAX_POS]; bool visited[MAX_TURN][MAX_POS][MAX_POS]; double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } if (turn >= MAX_TURN or pos_ao < 0 or pos_ao >= MAX_POS or pos_cho < 0 or pos_cho >= MAX_POS) { return INF; } double pro = (double)P / 100; if (visited[turn][pos_ao][pos_cho]) { return dp[turn][pos_ao][pos_cho]; } visited[turn][pos_ao][pos_cho] = true; double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); return dp[turn][pos_ao][pos_cho] = result; } int main() { cin >> X >> P; if (X > 10) return 0; int geta = MAX_POS / 2; double result = memo(0, geta, X + geta); printf("%.20lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #define mp make_pair #define mt make_tuple #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using double = long double; const int INF=1<<29; const double EPS=1e-9; const ll MOD = 1000000007; const int dx[]={1,0,-1,0},dy[]={0,-1,0,1}; ll X,P; const int MAX_TURN = 2000; const int MAX_POS = 100; double dp[MAX_TURN][MAX_POS][MAX_POS]; bool visited[MAX_TURN][MAX_POS][MAX_POS]; //map<tuple<int, int, int>, double> dp; double memo(int turn, int pos_ao, int pos_cho){ if (pos_ao == pos_cho){ return turn; } if (turn >= MAX_TURN or pos_ao < 0 or pos_ao >= MAX_POS or pos_cho < 0 or pos_cho >= MAX_POS){ return INF; } double pro = (double) P / 100; if (visited[turn][pos_ao][pos_cho]){ return dp[turn][pos_ao][pos_cho]; } visited[turn][pos_ao][pos_cho] = true; //cout << turn << " " << pos_ao << " " << pos_cho << endl; double result = INF; //pre result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); //stop result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); //next result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); return dp[turn][pos_ao][pos_cho] = result; } int main(){ cin >> X >> P; if (X > 10)return 0; int geta = MAX_POS / 2; double result = memo(0, geta, X + geta); printf("%.20lf\n", result); return 0;
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { cin >> x >> p; cout << (x + 1) / 2 << endl; return (0); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int p, x; std::cin >> p >> x; std::cout << (x + 1) / 2; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; if (p == 100) cout << (x / 2) + (x % 2) << ".000000\n"; else cout << "poop\n"; return 0; }