Submission #3436

# Submission time Handle Problem Language Result Execution time Memory
3436 2013-08-31T05:47:57 Z joinsung Divide into triangle (kriii1_D) C++
1 / 1
4 ms 1856 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin>>n;
  vector< pair<int,int> > points;
  for (int ni=0;ni<n*3;ni++) {
    int x,y;
    cin >> x >> y;
    points.push_back(make_pair(x,y));
  }
  vector< pair<double, int> > list;
  for (int ni=0;ni<n*3;ni++) {
    double dx = points[ni].first + 1000001;
    double dy = points[ni].second + 1000001;
    double angle = atan(dy/dx);
    list.push_back(make_pair(angle, ni+1));
  }
  sort(list.begin(), list.end());
  for (int ni=0;ni<n*3;ni++) {
    cout << list[ni].second;
    if (ni%3==2)
      cout<<endl;
    else
      cout<<" ";
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1856 KB Output is correct
2 Correct 0 ms 1856 KB Output is correct
3 Correct 0 ms 1856 KB Output is correct
4 Correct 0 ms 1856 KB Output is correct
5 Correct 0 ms 1856 KB Output is correct
6 Correct 0 ms 1856 KB Output is correct
7 Correct 0 ms 1856 KB Output is correct
8 Correct 0 ms 1856 KB Output is correct
9 Correct 0 ms 1856 KB Output is correct
10 Correct 0 ms 1856 KB Output is correct
11 Correct 0 ms 1856 KB Output is correct
12 Correct 0 ms 1856 KB Output is correct
13 Correct 0 ms 1856 KB Output is correct
14 Correct 0 ms 1856 KB Output is correct
15 Correct 0 ms 1856 KB Output is correct
16 Correct 0 ms 1856 KB Output is correct
17 Correct 4 ms 1856 KB Output is correct
18 Correct 0 ms 1856 KB Output is correct
19 Correct 0 ms 1856 KB Output is correct
20 Correct 0 ms 1856 KB Output is correct