Submission #82246

#TimeUsernameProblemLanguageResultExecution timeMemory
82246tjdgus4384공룡 발자국 (KOI18_footprint)C++14
0 / 100
4 ms576 KiB
#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); for(int i = 0;i < n;i++) { printf("%d %d\n", v[i].first + x[j], v[i].second + y[j]); } }

Compilation message (stderr)

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