# Setup máy trạm thi cho thí sinh ICPC ## Checklist các thứ cần: ### C++ 17 trở lên: - Cài Codeblock - Cài Dev-C++ - Cài bộ compiler: https://sourceforge.net/projects/mingw/ - Chọn tất cả gcc g++, rồi mark apply changes - Mở CMD lên nhập lệnh `gcc` đảm bảo nó không hiện như thế này: ![](https://i.imgur.com/Vp4Goqj.png) - Test compiler: ```c++ #include <bits/stdc++.h> using namespace std; int main() { vector<int> v {1,2,3,4,5,6,7,8,9,0}; map<int,int> m {{1,1},{2,2},{3,3},{4,4}}; sort(v.begin(), v.end(), [](int a, int b){ return b*b > a*3; }); int r=0; for (auto p : m) r += p.first; cout << r << " hello"; } ``` ### Java: - Cài Eclipse - Cài java compiler - Mở CMD lên nhập `javac` đảm bảo tồn tại - Save file as `GFG.java` then Test compiler: ```java import java.util.*; class Point { int x, y; Point(int x, int y){ this.x=x; this.y=y; } } class GFG { public static int orientation(Point p, Point q, Point r) { int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); if (val == 0) return 0; // collinear return (val > 0)? 1: 2; // clock or counterclock wise } // Prints convex hull of a set of n points. public static void convexHull(Point points[], int n) { // There must be at least 3 points if (n < 3) return; // Initialize Result Vector<Point> hull = new Vector<Point>(); // Find the leftmost point int l = 0; for (int i = 1; i < n; i++) if (points[i].x < points[l].x) l = i; // Start from leftmost point, keep moving // counterclockwise until reach the start point // again. This loop runs O(h) times where h is // number of points in result or output. int p = l, q; do { hull.add(points[p]); q = (p + 1) % n; for (int i = 0; i < n; i++) { if (orientation(points[p], points[i], points[q]) == 2) q = i; } p = q; } while (p != l); for (Point temp : hull) System.out.println("(" + temp.x + ", " + temp.y + ")"); } public static void main(String[] args) { Point points[] = new Point[7]; points[0]=new Point(0, 3); points[1]=new Point(2, 3); points[2]=new Point(1, 1); points[3]=new Point(2, 1); points[4]=new Point(3, 0); points[5]=new Point(0, 0); points[6]=new Point(3, 3); int n = points.length; convexHull(points, n); } } ``` ### Python 3 - Cài Eclipse - Cài python 3.8 intepreter - Mở CMD lên nhập `python3` đảm bảo tồn tại - Save file as `main.py` then Test compiler: ```python3= class Point: def __init__(self, x, y): self.x = x self.y = y def Left_index(points): minn = 0 for i in range(1,len(points)): if points[i].x < points[minn].x: minn = i elif points[i].x == points[minn].x: if points[i].y > points[minn].y: minn = i return minn def orientation(p, q, r): val = (q.y - p.y) * (r.x - q.x) - \ (q.x - p.x) * (r.y - q.y) if val == 0: return 0 elif val > 0: return 1 else: return 2 def convexHull(points, n): # There must be at least 3 points if n < 3: return # Find the leftmost point l = Left_index(points) hull = [] p = l q = 0 while(True): # Add current point to result hull.append(p) q = (p + 1) % n for i in range(n): # If i is more counterclockwise # than current q, then update q if(orientation(points[p], points[i], points[q]) == 2): q = i p = q # While we don't come to first point if(p == l): break for each in hull: print(points[each].x, points[each].y) # Driver Code points = [] points.append(Point(0, 3)) points.append(Point(2, 2)) points.append(Point(1, 1)) points.append(Point(2, 1)) points.append(Point(3, 0)) points.append(Point(0, 0)) points.append(Point(3, 3)) convexHull(points, len(points)) ```