답안 #82250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82250 2018-10-29T15:42:53 Z tjdgus4384 공룡 발자국 (KOI18_footprint) C++14
14 / 100
5 ms 1460 KB
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
vector<pair<ll, ll> > v;
ll x[3000], y[3000];

bool cmp(pair<ll, ll> a, pair<ll, ll> b)
{
    return a.first * b.second - a.second * b.first > 0;
}

int main()
{
    int n, j;
    ll m = 1000000000;
    scanf("%d", &n);
    for(int i = 0;i < n;i++)
    {
        scanf("%lld %lld", &x[i], &y[i]);
        if(y[i] < m) {m = y[i];j = i;}
    }
    for(int i = 0;i < n;i++)
    {
        if(i == j) continue;
        v.push_back({x[i] - x[j], y[i] - y[j]});
    }
    sort(v.begin(), v.end(), cmp);
    printf("%d\n", n);
    printf("%lld %lld\n", x[j], y[j]);
    for(int i = 0;i < v.size();i++)
    {
        printf("%lld %lld\n", v[i].first + x[j], v[i].second + y[j]);
    }
    return 0;
}

Compilation message

footprint.cpp: In function 'int main()':
footprint.cpp:32:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i < v.size();i++)
                   ~~^~~~~~~~~~
footprint.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
footprint.cpp:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &x[i], &y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
footprint.cpp:31:11: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
     printf("%lld %lld\n", x[j], y[j]);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 4 ms 1068 KB Output is correct
7 Correct 4 ms 1068 KB Output is correct
8 Correct 4 ms 1132 KB Output is correct
9 Correct 5 ms 1148 KB Output is correct
10 Correct 4 ms 1200 KB Output is correct
11 Correct 5 ms 1252 KB Output is correct
12 Correct 4 ms 1304 KB Output is correct
13 Correct 5 ms 1360 KB Output is correct
14 Correct 4 ms 1408 KB Output is correct
15 Correct 4 ms 1460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1460 KB Output is correct
2 Correct 2 ms 1460 KB Output is correct
3 Correct 2 ms 1460 KB Output is correct
4 Incorrect 2 ms 1460 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1460 KB Output is correct
2 Correct 2 ms 1460 KB Output is correct
3 Correct 2 ms 1460 KB Output is correct
4 Incorrect 2 ms 1460 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 504 KB Output is correct
2 Correct 4 ms 768 KB Output is correct
3 Correct 4 ms 768 KB Output is correct
4 Correct 4 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 4 ms 1068 KB Output is correct
7 Correct 4 ms 1068 KB Output is correct
8 Correct 4 ms 1132 KB Output is correct
9 Correct 5 ms 1148 KB Output is correct
10 Correct 4 ms 1200 KB Output is correct
11 Correct 5 ms 1252 KB Output is correct
12 Correct 4 ms 1304 KB Output is correct
13 Correct 5 ms 1360 KB Output is correct
14 Correct 4 ms 1408 KB Output is correct
15 Correct 4 ms 1460 KB Output is correct
16 Correct 3 ms 1460 KB Output is correct
17 Correct 2 ms 1460 KB Output is correct
18 Correct 2 ms 1460 KB Output is correct
19 Incorrect 2 ms 1460 KB Output isn't correct
20 Halted 0 ms 0 KB -