結果
| 問題 |
No.620 ぐるぐるぐるりん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-20 02:13:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,525 bytes |
| コンパイル時間 | 747 ms |
| コンパイル使用メモリ | 88,072 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-12-16 02:59:26 |
| 合計ジャッジ時間 | 6,628 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 17 TLE * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
using namespace std;
const double pi = acos(-1);
mt19937 mt(123456);
void solve() {
int t;
double p, w, v, gx, gy;
cin >> t >> p >> w >> v >> gx >> gy;
double gr = hypot(gx, gy);
double mn = 1e100;
for (int ii = 0; ii < 5000; ii++) {
double x = 1;
double y = 0;
vector<double> vx(t);
vector<double> vy(t);
double det = hypot(1 + v, w);
double theta = uniform_real_distribution<double>(0, 2*pi)(mt);
double c = exp(-(double)ii / 5000 * 20);
vx[0] = cos(theta) - 1;
vy[0] = sin(theta);
for (int i = 0; i < t; i++) {
double x0 = x;
double y0 = y;
x = x0 - y0*w + x0*v + vx[i];
y = y0 + x0*w + y0*v + vy[i];
double r = hypot(x, y);
double tr;
tr = 1;
if (i == t - 2) tr = gr * c;
double d = tr - r;
vx[i] += d*x / r;
vy[i] += d*y / r;
x += d*x / r;
y += d*y / r;
}
vx[t - 1] += gx - x;
vy[t - 1] += gy - y;
double s = 0;
for (int i = 0; i < t; i++) {
s += vx[i]*vx[i] + vy[i]*vy[i];
}
mn = min(mn, s);
if (s < p - 0.001) {
for (int i = 0; i < t; i++) {
printf("%.16f %.16f\n", vx[i], vy[i]);
}
fprintf(stderr, "Sum: %.16f\n", s);
fprintf(stderr, "p: %.16f\n", p);
return;
}
}
cout << "FAIL" << endl;
cout << endl;
cout << mn << endl;
}
int main() {
int T;
cin >> T;
while (T--) solve();
}