I and OI
Past...
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

#define rep(x) for (int i=0;i<x;i++) 
#define repc(c) for (typeof(c.begin()) i=c.begin();i!=c.end();i++)
#define pb push_back

struct test
{
	int x,y;
	bool operator <(const test& other) const
	{
		return x<other.x || (x==other.x && y<other.y);
	}
	bool operator ==(const test& other) const
	{
		return x==other.x && y==other.y; 
	}
};

test a[1000];
vector<test> v;
set<test> s;
priority_queue<test> q;
map<test,int> m;
int n,idx;

void input()
{
	scanf("%d\n",&n);
	rep(n) scanf("%d %d\n",&a[i].x,&a[i].y);
}

void output()
{
	rep(n) printf("%d %d\n",a[i].x,a[i].y);
	printf("-------\n");
}



int main()
{
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
	
	input();
	
	/*------sort------*/
	
	/*
	sort(a,a+n);
	output();
	*/
	
	/*------vector------*/
	
	/*
	rep(n) v.pb(a[i]);
	repc(v) printf("%d %d\n",i->x,i->y);
	*/
	
	/*------priority_queue------*/
	
	/* 
	rep(n) q.push(a[i]);
	while (!q.empty())
	{
		printf("%d %d\n",q.top().x,q.top().y);
		q.pop();
	}
	*/

	/*------set------*/
	
	/*
	rep(n) s.insert(a[i]);
	repc(s) printf("%d %d\n",i->x,i->y);
	*/
	
	/*------map------*/
	
	/*
	idx=0; 
	rep(n) if (m[a[i]]==0) m[a[i]]=++idx;
	rep(n) printf("%d\n",m[a[i]]);
	*/
	
	
	return 0;
}

  

posted on 2012-11-09 09:47  exponent  阅读(218)  评论(0编辑  收藏  举报