Submission #82248

# Submission time Handle Problem Language Result Execution time Memory
82248 2018-10-29T15:39:58 Z tjdgus4384 None (KOI18_footprint) C++14
0 / 100
4 ms 508 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)
{
    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++)
    {
        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("%d %d\n", x[j], y[j]);
    for(int i = 0;i < v.size();i++)
    {
        printf("%d %d\n", v[i].first + x[j], v[i].second + y[j]);
    }
    return 0;
}

Compilation message

footprint.cpp: In function 'int main()':
footprint.cpp:30:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i < v.size();i++)
                   ~~^~~~~~~~~~
footprint.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
footprint.cpp:19: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:29:11: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
     printf("%d %d\n", x[j], y[j]);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 508 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -