Submission #82250

#TimeUsernameProblemLanguageResultExecution timeMemory
82250tjdgus4384공룡 발자국 (KOI18_footprint)C++14
14 / 100
5 ms1460 KiB
#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 (stderr)

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]);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...