Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#define _CRT_SECURE_NO_WARNINGS
- //#pragma comment(linker,"/STACK:64000000")
- #include <stdio.h>
- #include <iostream>
- #include <math.h>
- #include <vector>
- #include <map>
- #include <set>
- #include <algorithm>
- #include <queue>
- #include <string>
- #include <string.h>
- #include <ctype.h>
- #include <iomanip>
- #include <iterator>
- #include <unordered_map>
- #include <unordered_set>
- #include <stdlib.h>
- #include <stack>
- #include <cstdio>
- #include <time.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> pii;
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- #define all(x) x.begin(),x.end()
- #define mp make_pair
- #define eps 1e-7
- #define PI 3.14159265358979323846
- #define ACCEPTED return 0;
- #define optimize cin.sync_with_stdio(false);cout.sync_with_stdio(false);cin.tie(0);
- const ll infinity = (ll) 1e18;
- #ifdef _DEBUG
- const int maxlen = (int)(1e1) + 10;
- #else
- const int maxlen = (int)(1e5) + 10;
- #endif
- const int base = (int)(1e9);
- const ll mod = base + 7;
- #define name ""
- double dist(pair<double,double > a, pair<double,double > b)
- {
- return (a.first-b.first)*(a.first-b.first) + (a.second-b.second)*(a.second-b.second);
- }
- vector<pair<pair<double,double >,int>> pt;
- int cnt[20];
- vector<pair<double,int >> nh;
- int main() {
- #ifdef _DEBUG
- freopen("input.txt", "rt", stdin);
- freopen("output.txt", "wt", stdout);
- /*#else
- freopen(name".in", "rt", stdin);
- freopen(name".out", "wt", stdout);*/
- #endif
- optimize;
- double n, k, t;
- cin >> n >> k >> t;
- double x, y;
- int c;
- for (int i = 0; i < n; i++) {
- cin >> x >> y >> c;
- pt.push_back({{x, y}, c});
- }
- while (t-- > 0) {
- memset(cnt, 0, sizeof(cnt));
- nh.clear();
- cin >> x >> y;
- pair<double,double > cur = {x, y};
- for (auto p:pt) {
- nh.push_back({dist(p.first, cur), p.second});
- }
- sort(all(nh));
- for (int i = 0; i < k; i++)
- cnt[nh[i].second]++;
- int ans = 0;
- for (int i = 0; i < 20; i++)
- if (cnt[i] > cnt[ans])
- ans = i;
- cout << ans << endl;
- }
- ACCEPTED
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement