# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82247 | tjdgus4384 | 공룡 발자국 (KOI18_footprint) | C++14 | 4 ms | 408 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector<pair<int, int> > v;
int x[3000], y[3000];
bool cmp(pair<int, int> a, pair<int, int> b)
{
if(a.second == 0) return true;
if(b.second == 0) return false;
return a.first * b.second - a.second * b.first > 0;
}
int main()
{
int n, j, m = 1000000000;
scanf("%d", &n);
for(int i = 0;i < n;i++)
{
scanf("%d %d", &x[i], &y[i]);
if(y[i] < m) {m = y[i];j = i;}
}
for(int i = 0;i < n;i++)
{
v.push_back({x[i] - x[j], y[i] - y[j]});
}
sort(v.begin(), v.end(), cmp);
printf("%d\n", n);
for(int i = 0;i < n;i++)
{
printf("%d %d\n", v[i].first + x[j], v[i].second + y[j]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |