Submission #3430

#TimeUsernameProblemLanguageResultExecution timeMemory
3430jiyong3Divide into triangle (kriii1_D)C++98
1 / 1
4 ms1672 KiB
#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 timeMemoryGrader output
Fetching results...