답안 #82247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82247 2018-10-29T15:36:56 Z tjdgus4384 공룡 발자국 (KOI18_footprint) C++14
0 / 100
4 ms 408 KB
#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

footprint.cpp: In function 'int main()':
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("%d %d", &x[i], &y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
footprint.cpp:32:43: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
         printf("%d %d\n", v[i].first + x[j], v[i].second + y[j]);
                                        ~~~^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -