Submission #3419386
Source Code Expand
#include<iostream> #include<vector> #include<math.h> #include<stdio.h> #include<algorithm> using namespace std; int main() { int N; cin >> N; vector<int> x(N), y(N); for(int i = 0; i < N; ++i){ cin >> x[i] >> y[i]; } for(int c = 0; c < N; ++c){ vector<int> ax(N), ay(N), ab(N); for(int i = 0; i < N; ++i){ for(int t = 0; t < N; ++t){ ax[c] = x[i] - x[t]; ay[c] = y[i] - y[t]; ab[c] = ax[c]*ax[c] + ay[c]*ay[c]; } } sort(ab); double rab1, rab2; rab1 = ab.end(); rab2 = sqrt(rab1); } cout << rab << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - 2点間距離の最大値 ( The longest distance ) |
User | Kant |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 616 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:12: error: no matching function for call to ‘sort(std::vector<int>&)’ sort(ab); ^ In file included from /usr/include/c++/5/algorithm:62:0, from ./Main.cpp:5: /usr/include/c++/5/bits/stl_algo.h:4689:5: note: candidate: template<class _RAIter> void std::sort(_RAIter, _RAIter) sort(_RandomAccessIterator __first, _RandomAccessIterator __last) ^ /usr/include/c++/5/bits/stl_algo.h:4689:5: note: template argument deduction/substitution failed: ./Main.cpp:23:12: note: candidate expects 2 arguments, 1 provided sort(ab); ^ In file included from /usr/include/c++/5/algorithm:62:0, from ./Main.cpp:5: /usr/include/c++/5/bits/stl_algo.h:4718:5: note: candidate: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare) sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ /usr/include/c++/5/bits/stl_algo.h:4718:5: note: template argument ded...