-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdiff_Main.cpp
More file actions
74 lines (69 loc) · 3.46 KB
/
Copy pathdiff_Main.cpp
File metadata and controls
74 lines (69 loc) · 3.46 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
74
diff --git a/CodeJam/Main.cpp b/examples/2021/Qualification/E/Main.cpp
index 2150379..8e80f15 100644
--- a/CodeJam/Main.cpp
+++ b/examples/2021/Qualification/E/Main.cpp
@@ -1566,15 +1566,68 @@ using namespace std;
namespace task {
+v(ld) difficulty = {2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9984999999999995, 2.9672999999999994, 2.9108999999999994, 2.8346999999999993, 2.7110999999999996, 2.5952999999999995, 2.5244999999999997, 2.3780999999999994, 2.2838999999999996, 2.2232999999999996, 2.1362999999999994, 2.0654999999999997, 1.9640999999999997, 1.8878999999999997, 1.7996999999999996, 1.7306999999999997, 1.6304999999999996, 1.5728999999999997, 1.5350999999999995, 1.4840999999999998, 1.3646999999999996, 1.3016999999999994, 1.2104999999999997, 1.1468999999999996, 1.1006999999999998, 0.9824999999999997, 0.9500999999999997, 0.8786999999999996, 0.7766999999999997, 0.7472999999999999, 0.6764999999999997, 0.5642999999999996, 0.5102999999999998, 0.49529999999999963, 0.3512999999999997, 0.30869999999999975, 0.2630999999999999, 0.1904999999999999, 0.13469999999999982, 0.05909999999999971, -0.038100000000000245, -0.08430000000000026, -0.12870000000000026, -0.21750000000000025, -0.2529000000000001, -0.29370000000000007, -0.4167000000000003, -0.4617000000000002, -0.5661000000000003, -0.6333000000000002, -0.6285000000000001, -0.7671000000000003, -0.8493000000000002, -0.9045000000000003, -0.9627000000000001, -1.0257, -1.0875000000000001, -1.1955000000000002, -1.2501000000000002, -1.2231, -1.4007, -1.4763000000000002, -1.5369000000000002, -1.6083, -1.6959000000000002, -1.7349, -1.7889000000000002, -1.9371, -1.9593, -2.1129, -2.1669, -2.2353, -2.3139000000000003, -2.4231, -2.5976999999999997, -2.6595000000000004, -2.7801, -2.8749000000000002, -2.9901, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955, -2.9955};
+
void init(){
- cin >> T;
+ ll P;
+ cin >> T >> P;
}
+const ll P = 100;
+const ll Q = 10000;
+bool answers[P][Q];
+
void readInput(){
+ forn(i, P){
+ str s;
+ cin >> s;
+ forn(j, Q) answers[i][j]=s[j]=='1';
+ // lg(answers[i][0]);
+ }
+}
+
+ld sigmoid(ld x){
+ return 1.0L / (1.0L + exp(-x));
}
// write to COMM_TYPE result
void calcFunction() {
+ v(ld) probable_diff;
+ v(ld) probable_skill;
+ forn(q, Q){
+ ll correctcounts = 0;
+ forn(p, P){
+ correctcounts += answers[p][q];
+ }
+ probable_diff.pb(difficulty[correctcounts]);
+ }
+ lg(probable_diff);
+ forn(p, P){
+ ll correctcounts = 0;
+ forn(q, Q){
+ correctcounts += answers[p][q];
+ }
+ probable_skill.pb(-difficulty[correctcounts/(Q/P)]);
+ }
+ lg(probable_skill);
+ v(ll) order_q_diff = argsort(probable_diff);
+ v(ll) player_corrects(P, 0);
+ v(ld) player_prob_corrects(P, 0.0);
+ fornn(i, Q-200, Q){
+ ll qidx = order_q_diff[i];
+ ld qdiff = probable_diff[qidx];
+ forn(p, P){
+ player_corrects[p] += answers[p][qidx];
+ player_prob_corrects[p] += sigmoid(probable_skill[p]-qdiff);
+ }
+ }
+ v(ld) discrp;
+ forn(p, P){
+ discrp.pb(player_corrects[p]-player_prob_corrects[p]);
+ }
+ lg(discrp);
+ result = 1 + max_element(all(discrp))-discrp.bn;
+ lg(discrp[result-1]);
}
} // namespace task