# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3664 | eldkqmfhf123 | Divide into triangle (kriii1_D) | C++98 | 0 ms | 1684 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
struct queue
{
int x, y, index;
bool operator()(queue a, queue b)
{
if(a.x < b.x)return 1;
if(a.x == b.x && a.y < b.y)return 1;
return 0;
}
}list[901];
int main()
{
int n;
cin >> n;
n*=3;
int i,j;
for(i=0;i<n;i++)
{
cin >> list[i].x >> list[i].y;
list[i].index = i+1;
}
std::sort(list,list+n,queue());
int visit[901]={0,};
for(int t=0;t<n/3;t++)
{
int ans=0;
for(i=0;i<n;i++)
{
if(visit[i])continue;
for(j=i+1;j<n;j++)
{
if(visit[j])continue;
for(int k=j+1;k<n;k++)
{
if(visit[k])continue;
cout << list[i].index << " " << list[j].index << " " << list[k].index << endl;
visit[i]=1;
visit[j]=1;
visit[k]=1;
ans=1;
break;
}
if(ans)break;
}
if(ans)break;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |