Submission #3406

# Submission time Handle Problem Language Result Execution time Memory
3406 2013-08-31T05:33:16 Z waps12b Divide into triangle (kriii1_D) C++
0 / 1
0 ms 1252 KB
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define ll long long 
#define ccw(a,b,c) ( (a.x*b.y + b.x*c.y + c.x * a.y ) - ( a.y*b.x + b.y*c.x + c.y * a.x) )
struct pt{
	ll x,y;
	int pos;
	pt(){}
	pt(ll x,ll y){
		this->x=x;
		this->y=y;
	}
};
pt v[300];
bool compare(pt a,pt b){
	return make_pair(a.x,a.y) < make_pair(b.x,b.y);
}
bool poscompare(pt a,pt  b){
	return a.pos	 < b.pos;
}


int main(){
	int n;scanf("%d",&n);
	n*=3;
	for(int i=0;i<n;i++){
		ll x, y;scanf("%lld %lld",&x,&y);
		v[i] = pt(x,y);
		v[i].pos = i+1;
	}
	sort(v,v+n,compare);
	vector<string> ans;
	for(int i=0;i<n;i+=3){
		sort(v+i,v+i+3,poscompare);
		string t = "";
		t += (v[i].pos +'0');
		t += ' ';
		t += (v[i+1].pos+'0');
		t += ' ';
		t += (v[i+2].pos+'0');
		ans.push_back(t);
	}
	sort(ans.begin(),ans.end());
	for(int i=0;i<ans.size();i++)
		printf("%s\n",ans[i].c_str());
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1252 KB Output isn't correct
2 Halted 0 ms 0 KB -