-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdiff_Main.cpp
More file actions
50 lines (46 loc) · 1.47 KB
/
Copy pathdiff_Main.cpp
File metadata and controls
50 lines (46 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/CodeJam/Main.cpp b/examples/2019/Round2/A/Main.cpp
index 2150379..37d9baa 100644
--- a/CodeJam/Main.cpp
+++ b/examples/2019/Round2/A/Main.cpp
@@ -4,7 +4,7 @@
// #define IA_MODE //remove comment on this line, to activate interactive problem mode
#define IA_ERROR_CODE -1
#define IA_COMM_LOG //add comment on this line, to deactivate the interactive communication error log
-// #define XY_NOTATION //remove commment on this line, to activate xy notation on complex numbers
+#define XY_NOTATION //remove commment on this line, to activate xy notation on complex numbers
#define COMM_TYPE ll
// The maintained and empty code template can be found at:
@@ -1570,11 +1570,36 @@ void init(){
cin >> T;
}
+ll N;
+v(cell) mols;
+s(ld) ratios;
+
void readInput(){
+ cin >> N;
+ mols.cl;
+ ratios.cl;
+ forn(i, N){
+ ll s, t;
+ cin >> s >> t;
+ mols.emplace_back(s,t);
+ }
}
// write to COMM_TYPE result
void calcFunction() {
+ forn(i, N){
+ fornn(j, i+1, N){
+ if(mols[i].x >= mols[j].x && mols[i].y >= mols[j].y) continue;
+ if(mols[i].x <= mols[j].x && mols[i].y <= mols[j].y) continue;
+ ll delx = abs(mols[i].x - mols[j].x);
+ ll dely = abs(mols[i].y - mols[j].y);
+ ll g = gcd(delx, dely);
+ delx /= g;
+ dely /= g;
+ ratios.insert(ld(delx) / dely);
+ }
+ }
+ result = 1 + ratios.sz;
}
} // namespace task