Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <set>
  7. #include <string>
  8. #include <algorithm>
  9. #include <stack>
  10. #include <map>
  11. #include <fstream>
  12.  
  13. #pragma GCC optimize("no-stack-protector")
  14. #pragma comment(linker, "/STACK:99999999999999999")
  15.  
  16. using namespace std;
  17.  
  18. const long double eps = 1e-10;
  19. const long double inf = 999999999999999;
  20. const long double pi = 3.141592653589793238462643383279;
  21.  
  22. ostream& operator << (ostream& out, const vector<int>& s){
  23. for (int i = 0; i < s.size(); ++i){
  24. out << s[i] << ' ';
  25. }
  26. return out;
  27. }
  28.  
  29. ostream& operator << (ostream& out, pair<int, int>& a){
  30. out << a.first << ' ' << a.second;
  31. return out;
  32. }
  33.  
  34. int main(){
  35. // freopen("coins.in", "r", stdin);
  36. // freopen("coins.out", "w", stdout);
  37. // cout.precision(10);
  38. // cout << fixed;
  39. // ifstream fin("input.txt");
  40. cin.tie(0);
  41. ios_base::sync_with_stdio(false);
  42. int n, m, k;
  43. cin >> n >> m >> k;
  44. map<int, int> cities;
  45. map<int, int> teams;
  46. for (int i = 0; i < k; ++i){
  47. int a, b;
  48. cin >> a >> b;
  49. ++cities[a];
  50. ++teams[b];
  51. }
  52. int ans = 0;
  53. for (auto now: cities){
  54. ans = max(ans, (int)ceil((double)now.second / 3));
  55. }
  56. for (auto now: teams){
  57. ans = max(ans, (int)ceil((double)now.second / 3));
  58. }
  59. cout << ans;
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement