Advertisement
Asif_Anwar

UVA-855

Jul 26th, 2021
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. //using namespace chrono;
  5.  
  6. typedef long long ll;
  7. typedef vector< int > vi;
  8. typedef vector< ll > V;
  9. typedef map<int, int > mp;
  10.  
  11. #define pb push_back
  12. #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  13. #define F first
  14. #define S second
  15.  
  16. #define debug cout << -1 << endl;
  17. #define REP(i, a, b) for(int i=a; i<b; i++)
  18. #define f0r(i, n) for (int i = 0; i < n; ++i)
  19. #define f0r1(i, n) for (int i = 1; i <= n; ++i)
  20. #define r0f(i, n) for(int i=n-1; i>=0; i--)
  21. #define r0f1(i, n) for(int i=n; i>=1; i--)
  22. #define fore(a, x) for (auto& a : x)
  23. #define fori(i, a, b) for (int i = (a); i < (b); ++i)
  24.  
  25. #define MP make_pair
  26. #define UB upper_bound
  27. #define LB lower_bound
  28. #define nw cout << "\n"
  29.  
  30. #define issq(x) (((ll)(sqrt((x))))*((ll)(sqrt((x))))==(x))
  31. #define rev(v) reverse(v.begin(),v.end())
  32. #define asche cerr<<"Ekhane asche\n";
  33. #define rev(v) reverse(v.begin(),v.end())
  34. #define srt(v) sort(v.begin(),v.end())
  35. #define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
  36. #define all(v) v.begin(),v.end()
  37. #define mnv(v) *min_element(v.begin(),v.end())
  38. #define mxv(v) *max_element(v.begin(),v.end())
  39. #define valid(tx,ty) (tx>=0 && tx<n && ty>=0 && ty<m)
  40. #define one(x) __builtin_popcount(x)
  41. //#define pop pop_back
  42. #define setPrec(x) cout << fixed << setprecision(x)
  43. #define sz(a) (int)a.size()
  44. //#define fin cin
  45. //#define fout cout
  46. const int INF = 1e9;
  47. const ll MOD = (ll)1e9+7;
  48. const ll INFL = 1e18;
  49. const ll mnINF = -1e18;
  50. const double diff = 10e-6;
  51. const int maxn = 200005;
  52. const double PI = acos(-1);
  53. using namespace std;
  54.  
  55. // int dx[] = {-1, 0, 1};
  56. // int dy[] = {-1, 0, 1};
  57.  
  58. int dx[] = {-1, 0, 0, 1};
  59. int dy[] = {0, -1, 1, 0};
  60.  
  61. int tt = 0;
  62. void solve()
  63. {
  64.     int n, m, f;
  65.     cin >> n >> m >> f;
  66.     vector< int > v1(f), v2(f);
  67.     int s1 = 0, s2 = 0;
  68.     f0r(i, f) {
  69.         cin >> v1[i] >> v2[i];
  70.     }
  71.     srt(v1);
  72.     srt(v2);
  73.     int st, av;
  74.     st = v1[(f-1)/2];
  75.     av = v2[(f-1)/2];
  76.     // st = s1/f;
  77.     // av = s2/f;
  78.     cout << "(Street: " << st << ", Avenue: " << av << ")\n";
  79. }
  80.  
  81. void setIO(string name = "") { // name is nonempty for USACO file I/O
  82.  
  83.     ios_base::sync_with_stdio(0); cin.tie(0); // see Fast Input & Output
  84.  
  85.     // alternatively, cin.tie(0)->sync_with_stdio(0);
  86.  
  87.     if (name.size()) {
  88.  
  89.         freopen((name+".in").c_str(), "r", stdin); // see Input & Output
  90.  
  91.         freopen((name+".out").c_str(), "w", stdout);
  92.  
  93.     }
  94.  
  95. }
  96.  
  97. int main()
  98. {
  99. #ifndef ONLINE_JUDGE
  100.     freopen("inputf.in", "r", stdin);
  101.     freopen("outputf.in", "w", stdout);
  102. #endif
  103.     //setIO("breedflip");
  104.     FastIO;
  105.     int t;
  106.     t = 1;
  107.     cin >> t;
  108.     f0r(i, t) {
  109.         //cout << "Case " << i+1 << ": ";
  110.         solve();
  111.     }
  112.     return 0;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement