結果
| 問題 | No.635 自然門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-19 03:28:38 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 675 bytes |
| 記録 | |
| コンパイル時間 | 1,379 ms |
| コンパイル使用メモリ | 216,444 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-14 15:45:56 |
| 合計ジャッジ時間 | 2,445 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 WA * 4 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
void solve(){
int x[3],v[3];
rep(i,3) scanf("%d",&x[i]);
rep(i,3) scanf("%d",&v[i]);
vector<double> T={0,1e9};
rep(i,3) rep(j,3) if(i!=j) {
if(x[i]<x[j] && v[i]>v[j]){
// x_i+v_i*t = x_j+v_j*t <=> t = (x_j-x_i)/(v_i-v_j)
T.emplace_back(double(x[j]-x[i])/(v[i]-v[j]));
}
}
sort(T.begin(),T.end());
rep(i,T.size()-1){
double t=(T[i]+T[i+1])/2;
double a[3];
rep(j,3) a[j]=x[j]+v[j]*t;
if((a[0]>a[1] && a[1]<a[2]) || (a[0]<a[1] && a[1]>a[2])){
puts("YES");
return;
}
}
puts("NO");
}
int main(){
int q; scanf("%d",&q); rep(_,q) solve();
return 0;
}