Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <vector>
- #define UNIVERSE_SIZE 4294967295
- #define MAX_TO_LAUNCH 1000
- #define MAX_ON_SPACE 100000
- using namespace std;
- map<long int, map<long int, int> > init(long int spLaunched[][2], long int n) {
- map<long int, map<long int, int> > universe;
- for( int i = 0; i < n; i++ ) {
- universe[spLaunched[i][0]][spLaunched[i][1]] = 1;
- }
- return universe;
- }
- vector<int> solve(long int spLaunched[][2], int spToLaunch[][2], long int n, int k) {
- map<long int, map<long int, int> > universe = init(spLaunched, n);
- vector<int> result;
- for(int i = 0; i < k; i++) {
- int value = universe[spToLaunch[i][0]][spToLaunch[i][1]];
- if(value == 1) {
- result.push_back(0);
- } else {
- result.push_back(1);
- }
- }
- return result;
- }
- int main() {
- long int n;
- int k;
- long int input[][2] = {};
- cin >> n >> k;
- long int spLaunched[n][2];
- int spToLaunch[k][2];
- for(long int i = 0; i < n; i++) cin >> spLaunched[i][0] >> spLaunched[i][1];
- for(int i = 0; i < k; i++) { cin >> spToLaunch[i][0] >> spToLaunch[i][1];}
- vector<int> result = solve(spLaunched, spToLaunch, n, k);
- for(int i = 0; i < k; i++) {
- cout << result[i] << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment