Submission #4034624
Source Code Expand
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
sort(ALL(c)); \
for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))
// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))
//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const double PI = (double)acos(-1);
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};
//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
//
struct Accelerate_Cin {
Accelerate_Cin() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
};
};
signed main() {
int x1, y1, x2, y2;
int N;
vec X(N), Y(N);
vector<P> v;
cin >> x1 >> y1 >> x2 >> y2;
cin >> N;
for (int i = 0; i < N; i++) cin >> X[i] >> Y[i];
if (x1 > x2) {
x1 = 100000000 - x1;
x2 = 100000000 - x2;
for (int i = 0; i < N; i++) X[i] = 100000000 - X[i];
}
if (y1 > y2) {
y1 = 100000000 - y1;
y2 = 100000000 - y2;
for (int i = 0; i < N; i++) Y[i] = 100000000 - Y[i];
}
for (int i = 0; i < N; i++) {
if (y1 <= Y[i] && Y[i] <= y2 && x1 <= X[i] && X[i] <= x2) v.pb(P(X[i], Y[i]));
}
double gd = 20.0 - 5.0 * PI;
sort(ALL(v));
vec dp(N, INF);
for (int i = 0; i < v.size(); i++) {
int tmp = (int)(lower_bound(ALL(dp), v[i].second) - dp.begin());
chmin(dp[tmp], v[i].second);
}
int num = (int)(lower_bound(ALL(dp), INF) - dp.begin());
double ans = (double)(abs(x1 - x2) * 100.0 + abs(y1 - y2) * 100.0 - num * gd);
if (num == min(abs(x1 - x2), abs(y1 - y2)) + 1) ans += 5.0 * PI;
cout << fixed << setprecision(15) << ans << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Fountain Walk |
User |
null_null |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
3040 Byte |
Status |
RE |
Exec Time |
101 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 900 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
All |
sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt, subtask_1_30.txt, subtask_1_31.txt, subtask_1_32.txt, subtask_1_33.txt, subtask_1_34.txt, subtask_1_35.txt, subtask_1_36.txt, subtask_1_37.txt, subtask_1_38.txt, subtask_1_39.txt, subtask_1_40.txt, subtask_1_41.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
RE |
98 ms |
256 KB |
sample_02.txt |
RE |
98 ms |
256 KB |
sample_03.txt |
RE |
98 ms |
256 KB |
subtask_1_01.txt |
RE |
98 ms |
256 KB |
subtask_1_02.txt |
RE |
98 ms |
256 KB |
subtask_1_03.txt |
RE |
101 ms |
256 KB |
subtask_1_04.txt |
RE |
99 ms |
256 KB |
subtask_1_05.txt |
RE |
101 ms |
256 KB |
subtask_1_06.txt |
RE |
98 ms |
256 KB |
subtask_1_07.txt |
RE |
97 ms |
256 KB |
subtask_1_08.txt |
RE |
99 ms |
256 KB |
subtask_1_09.txt |
RE |
97 ms |
256 KB |
subtask_1_10.txt |
RE |
98 ms |
256 KB |
subtask_1_11.txt |
RE |
98 ms |
256 KB |
subtask_1_12.txt |
RE |
98 ms |
256 KB |
subtask_1_13.txt |
RE |
98 ms |
256 KB |
subtask_1_14.txt |
RE |
98 ms |
256 KB |
subtask_1_15.txt |
RE |
98 ms |
256 KB |
subtask_1_16.txt |
RE |
98 ms |
256 KB |
subtask_1_17.txt |
RE |
97 ms |
256 KB |
subtask_1_18.txt |
RE |
98 ms |
256 KB |
subtask_1_19.txt |
RE |
98 ms |
256 KB |
subtask_1_20.txt |
RE |
98 ms |
256 KB |
subtask_1_21.txt |
RE |
98 ms |
256 KB |
subtask_1_22.txt |
RE |
98 ms |
256 KB |
subtask_1_23.txt |
RE |
98 ms |
256 KB |
subtask_1_24.txt |
RE |
99 ms |
256 KB |
subtask_1_25.txt |
RE |
98 ms |
256 KB |
subtask_1_26.txt |
RE |
98 ms |
256 KB |
subtask_1_27.txt |
RE |
98 ms |
256 KB |
subtask_1_28.txt |
RE |
98 ms |
256 KB |
subtask_1_29.txt |
RE |
98 ms |
256 KB |
subtask_1_30.txt |
RE |
99 ms |
256 KB |
subtask_1_31.txt |
RE |
98 ms |
256 KB |
subtask_1_32.txt |
RE |
98 ms |
256 KB |
subtask_1_33.txt |
RE |
99 ms |
256 KB |
subtask_1_34.txt |
RE |
99 ms |
256 KB |
subtask_1_35.txt |
RE |
98 ms |
256 KB |
subtask_1_36.txt |
RE |
97 ms |
256 KB |
subtask_1_37.txt |
RE |
98 ms |
256 KB |
subtask_1_38.txt |
RE |
98 ms |
256 KB |
subtask_1_39.txt |
RE |
98 ms |
256 KB |
subtask_1_40.txt |
RE |
98 ms |
256 KB |
subtask_1_41.txt |
RE |
99 ms |
256 KB |