답안 #3941

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3941 2013-08-31T09:32:09 Z joonas Divide into triangle (kriii1_D) C++
1 / 1
0 ms 1672 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

vector< pair<int,int> > pt;
int main(){
	int i,j, n, tmp;
	cin >> n;
	for(i=0; i < 3*n; ++i){
		cin >> tmp >> tmp;
		pt.push_back(pair<int,int>(i+1,tmp));
	}
	for(i=0; i < 3*n; ++i){
		for(j=0; j < 3*n; ++j){
			if( pt[i].second < pt[j].second ) std::swap( pt[i], pt[j] );
		}
	}

	for(i=0; i < 3*n; i+=3){
		for(j=i; j < i+3; ++j){
			for(int k=i; k < i+3; ++k){
				if( pt[j].first < pt[k].first ) std::swap( pt[j], pt[k] );
			}
		}
		for(j=i; j < i+3; ++j) cout<< pt[j].first <<' ';
		cout<<'\n';
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1672 KB Output is correct
2 Correct 0 ms 1672 KB Output is correct
3 Correct 0 ms 1672 KB Output is correct
4 Correct 0 ms 1672 KB Output is correct
5 Correct 0 ms 1672 KB Output is correct
6 Correct 0 ms 1672 KB Output is correct
7 Correct 0 ms 1672 KB Output is correct
8 Correct 0 ms 1672 KB Output is correct
9 Correct 0 ms 1672 KB Output is correct
10 Correct 0 ms 1672 KB Output is correct
11 Correct 0 ms 1672 KB Output is correct
12 Correct 0 ms 1672 KB Output is correct
13 Correct 0 ms 1672 KB Output is correct
14 Correct 0 ms 1672 KB Output is correct
15 Correct 0 ms 1672 KB Output is correct
16 Correct 0 ms 1672 KB Output is correct
17 Correct 0 ms 1672 KB Output is correct
18 Correct 0 ms 1672 KB Output is correct
19 Correct 0 ms 1672 KB Output is correct
20 Correct 0 ms 1672 KB Output is correct