Advertisement
Guest User

Untitled

a guest
May 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. #pragma GCC omptimize("unroll-loops")
  2. #pragma GCC optimize("no-stack-protector")
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. int n;
  7. int x[1000];
  8. int  y[1000];
  9. vector <double> s;
  10.  
  11. bool comppp (int a,int b) {
  12.     return (a>b);
  13.  }
  14. int main () {
  15.    #ifdef LOCAL
  16.     freopen("moria.in", "r", stdin);
  17.     freopen("moria.out", "w", stdout);
  18.    #endif
  19.     int m , n;
  20.     cin >> m >> n;
  21.     s.resize(m );
  22.     //cout << m << endl;
  23.     for(int i = 0; i < m; i++) {
  24.         cin >> x[i] >> y[i];
  25.     }
  26. //  cout << x[0] << endl;
  27. //  cout << y[0] << endl;
  28.     for(int i = 0; i < m; i++) {
  29.            
  30.             s[i] = sqrt(pow(x[i] , 2) + pow(y[i], 2));
  31.            
  32.         }
  33.     //  for(int i = 0; i < s.size(); i++) cout << s[i] << " ";
  34.     //cout << endl;
  35.     sort(s.begin(), s.end());
  36.     //for(int i = 0; i < s.size(); i++) cout << s[i] << " ";
  37.     //cout << endl;
  38.     //cout << s[n] << endl;
  39.     int l = round(pow(s[n], 2));
  40.     cout << l;
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement