Submission #3449

# Submission time Handle Problem Language Result Execution time Memory
3449 2013-08-31T05:52:17 Z wurikiji Divide into triangle (kriii1_D) C++
1 / 1
0 ms 1676 KB
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;
struct point{
	int x;
	int y;
	int i;
	point(int a, int b, int c)
		: x(a), y(b), i(c)
	{}
};
vector<point> ls;
bool ss(point a, point b )
{
	if( a.x == b.x)
		return a.y < b.y;
	return a.x < b.x;
}
int main(void){
	int n;
	scanf("%d",&n);

	ls.clear();

	for(int i = 0 ;i <3 * n ;i++)
	{
		int a, b;
		scanf("%d %d",&a,&b);
		ls.push_back(point(a,b,i));
	}
	sort(ls.begin(),ls.end(),ss);

	for(int i = 0 ;i < 3*n;i++)
	{
		printf("%d ", ls[i].i + 1);
		if( i %3 == 2 )printf("\n");
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1676 KB Output is correct
2 Correct 0 ms 1676 KB Output is correct
3 Correct 0 ms 1676 KB Output is correct
4 Correct 0 ms 1676 KB Output is correct
5 Correct 0 ms 1676 KB Output is correct
6 Correct 0 ms 1676 KB Output is correct
7 Correct 0 ms 1676 KB Output is correct
8 Correct 0 ms 1676 KB Output is correct
9 Correct 0 ms 1676 KB Output is correct
10 Correct 0 ms 1676 KB Output is correct
11 Correct 0 ms 1676 KB Output is correct
12 Correct 0 ms 1676 KB Output is correct
13 Correct 0 ms 1676 KB Output is correct
14 Correct 0 ms 1676 KB Output is correct
15 Correct 0 ms 1676 KB Output is correct
16 Correct 0 ms 1676 KB Output is correct
17 Correct 0 ms 1676 KB Output is correct
18 Correct 0 ms 1676 KB Output is correct
19 Correct 0 ms 1676 KB Output is correct
20 Correct 0 ms 1676 KB Output is correct