# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
547642 | amunduzbaev | A Game with Grundy (CCO20_day1problem1) | C++17 | 69 ms | 4932 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define ar array
const double eps = 1e-5;
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n; cin>>n;
int l, r, y; cin>>l>>r>>y;
vector<ar<int, 2>> tot;
for(int i=0;i<n;i++){
int x, u, v; cin>>x>>u>>v;
ar<double, 2> s, b;
s[0] = u * 1. / v, s[1] = -s[0];
b[0] = s[1] * x, b[1] = -b[0];
double L = (y - b[0]) / s[0], R = (y - b[1]) / s[1];
if(L - R > eps) swap(L, R);
int l = ceil(L), r = floor(R);
if(abs(l - L) < eps) l++;
if(abs(r - R) < eps) r--;
tot.push_back({l, 1});
tot.push_back({++r, -1});
//~ cout<<l<<" "<<r<<"\n";
}
tot.push_back({l, 0});
tot.push_back({r + 1, 0});
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |