pranay_teja
9/28/2018 - 6:10 AM

Pairs in Maps

#include <bits/stdc++.h>
using namespace std;

// #Maps #Hashing #IMP_NOTES
// https://www.geeksforgeeks.org/map-pairs-stl/
// https://www.geeksforgeeks.org/map-associative-containers-the-c-standard-template-library-stl/

int main() {
    int n;
    cin>> n;
    map< pair<int,int>, int > m;
    while(n--){
	    int x,y,data;
	    cin>> x >> y >> data;
	    m[{x,y}] = data;
	
    }
    for(auto it = m.begin();it != m.end();it++){
       cout << (it->first).first;
       cout << " ";
       cout << (it->first).second;
       cout << " ";
       cout <<"data: ";
       cout << (it->second)<<endl;
    }
	return 0;
}