-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdiff_Main.cpp
More file actions
73 lines (68 loc) · 1.82 KB
/
Copy pathdiff_Main.cpp
File metadata and controls
73 lines (68 loc) · 1.82 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
diff --git a/CodeJam/Main.cpp b/examples/2022/Round1A/B/Main.cpp
index 2150379..b991d22 100644
--- a/CodeJam/Main.cpp
+++ b/examples/2022/Round1A/B/Main.cpp
@@ -1,7 +1,7 @@
// #define DEFAULT_VAL_MODE //remove comment on this line, to activate default value trigger
#define DEFAULT_VAL_TRIGGER result.sz == 0
#define DEFAULT_VAL "IMPOSSIBLE"
-// #define IA_MODE //remove comment on this line, to activate interactive problem mode
+#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
@@ -1566,15 +1566,59 @@ using namespace std;
namespace task {
+s(ll) Ai;
void init(){
cin >> T;
+ ll last = 1<<29;
+ while(!Ai.count(last)){
+ Ai.insert(last);
+ last = last / 2 + 1;
+ }
+ ll c = 1;
+ while(Ai.sz < 100){
+ if(Ai.count(c)){
+ c++;
+ continue;
+ } else {
+ Ai.insert(c);
+ c++;
+ }
+ }
}
+ll N;
+
void readInput(){
+ cin >> N;
}
// write to COMM_TYPE result
void calcFunction() {
+ out(Ai);
+ s(ll) all_vals;
+ forn(i, N){
+ ll t = in();
+ all_vals.insert(t);
+ }
+ foreach(ai, Ai)
+ all_vals.insert(ai);
+
+ ll s = accumulate(all(all_vals), 0LL);
+ lg(s);
+ lassert(s%2==0, "logic error");
+ ll t = s/2;
+
+ ll left = 0, right = 0;
+ v(ll) returns;
+ for(auto it=all_vals.rbegin(); it!=all_vals.rend(); ++it){
+ if(left < right){
+ left += *it;
+ returns.pb(*it);
+ } else {
+ right += *it;
+ }
+ }
+ out(returns);
}
} // namespace task