Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <cstdio>
- #include <cstdlib>
- #include <set>
- #include <string>
- #include <algorithm>
- #include <stack>
- #include <map>
- #include <fstream>
- #pragma GCC optimize("no-stack-protector")
- #pragma comment(linker, "/STACK:99999999999999999")
- using namespace std;
- const long double eps = 1e-10;
- const long double inf = 999999999999999;
- const long double pi = 3.141592653589793238462643383279;
- ostream& operator << (ostream& out, const vector<int>& s){
- for (int i = 0; i < s.size(); ++i){
- out << s[i] << ' ';
- }
- return out;
- }
- ostream& operator << (ostream& out, pair<int, int>& a){
- out << a.first << ' ' << a.second;
- return out;
- }
- int main(){
- // freopen("coins.in", "r", stdin);
- // freopen("coins.out", "w", stdout);
- // cout.precision(10);
- // cout << fixed;
- // ifstream fin("input.txt");
- cin.tie(0);
- ios_base::sync_with_stdio(false);
- int n, m, k;
- cin >> n >> m >> k;
- map<int, int> cities;
- map<int, int> teams;
- for (int i = 0; i < k; ++i){
- int a, b;
- cin >> a >> b;
- ++cities[a];
- ++teams[b];
- }
- int ans = 0;
- for (auto now: cities){
- ans = max(ans, (int)ceil((double)now.second / 3));
- }
- for (auto now: teams){
- ans = max(ans, (int)ceil((double)now.second / 3));
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement