# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3430 | jiyong3 | Divide into triangle (kriii1_D) | C++98 | 4 ms | 1672 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>
using namespace std;
#define MAXN 300
void swap(int &a,int &b)
{
int t=a;
a=b;
b=t;
}
int main()
{
int n;
int x[MAXN*3];
int y[MAXN*3];
int no[MAXN*3];
cin >> n;
for(int i=0;i<n*3;i++)
{
cin >> x[i] >> y[i];
no[i]=i;
}
for(int i=0;i<n*3;i++)
for(int j=i+1;j<n*3;j++)
if(y[i]>y[j])
{
swap(x[i],x[j]);
swap(y[i],y[j]);
swap(no[i],no[j]);
}
for(int i=0;i<n*3;i++)
for(int j=i+1;j<n*3;j++)
if(x[i]>x[j])
{
swap(x[i],x[j]);
swap(y[i],y[j]);
swap(no[i],no[j]);
}
for(int i=1;i<=n*3;i++)
{
cout << no[i-1]+1 << " ";
if(i%3==0)
cout << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |