| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 577939 | MohamedFaresNebili | A Game with Grundy (CCO20_day1problem1) | C++14 | 265 ms | 6984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
double inters(double a, double b, double y){
double p = (y-b)/(double)a;
return p;
}
int main() {
long long count0[100005];
memset(count0,0,sizeof count0);
int n, l, r, y;
cin >> n >> l >> r >> y;
vector<pair<double,int>> pnts;
for(int i = 0;i<n;i++){
int x, v, h;
cin >> x >> v >> h;
double a = v/(double)h;
double b = -a*x;
pnts.push_back({inters(a,b,y),-1});
pnts.push_back({inters(-a,-b,y),1});
}
for(int i = 0;i<pnts.size();i++){
if(pnts[i].second == 1)pnts[i].first += 10e-6;
else pnts[i].first -= 10e-6;
}
sort(pnts.begin(), pnts.end());
int left = l, c = 0;
for(int i = 0; i < pnts.size(); i++){
if(pnts[i].first > r)break;
if(pnts[i].first < l){
if(pnts[i].second == 1)
c++;
else
c--;
continue;
}
count0[c] += ceil(pnts[i].first) - left;
if(pnts[i].second == 1)
c++;
else
c--;
left = ceil(pnts[i].first);
}
count0[c] += r - left + 1;
for(int i = 0; i <= n; i++){
if(i != 0)
count0[i] += count0[i-1];
cout << count0[i] << endl;
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
