fork download
  1. #pragma GCC optimize("Ofast")
  2. //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
  3.  
  4. #include "testlib.h"
  5. #include <bits/stdc++.h>
  6. #include <ext/pb_ds/assoc_container.hpp>
  7. #include <ext/pb_ds/tree_policy.hpp>
  8.  
  9.  
  10. #define ll long long
  11. #define ld long double
  12. #define F first
  13. #define S second
  14. #define pb push_back
  15. #define sqr(x) (x) * (x)
  16.  
  17. using namespace std;
  18. using namespace __gnu_pbds;
  19.  
  20. mt19937_64 gen(time(0));
  21.  
  22. int func(int x)
  23. {
  24. return gen() % x;
  25. }
  26.  
  27. typedef tree<
  28. pair <int, int>,
  29. null_type,
  30. less<pair <int, int>>,
  31. rb_tree_tag,
  32. tree_order_statistics_node_update>
  33. ordered_set;
  34.  
  35. //const int mod = 1e9 + 7;
  36.  
  37.  
  38. ld score(ll a, ll b)
  39. {
  40. if (a == b)
  41. {
  42. return 10.;
  43. }
  44. return ceil(((ld)a * a) / ((ld)b * b) * 10. * 100) / 100;
  45. }
  46.  
  47.  
  48. const int maxn = 1e6 + 66;
  49. const int maxk = 1e6 + 66;
  50. const int maxq = 3e7;
  51.  
  52. map <int, int> g[maxn];
  53. bool used[maxk];
  54. bool cas[maxk];
  55.  
  56. int a[maxn], b[maxn], c[maxn];
  57. int castles[maxk];
  58.  
  59. int n, m, k, t, A, s;
  60.  
  61.  
  62.  
  63. int main(int argc, char * argv[])
  64. {
  65. cin.tie(0);
  66. cout.tie(0);
  67. ios_base::sync_with_stdio(false);
  68. setName("scored checker");
  69. registerTestlibCmd(argc, argv);
  70. int test_id = inf.readInt();inf.skipBlanks();
  71. n = inf.readInt(1, maxn);inf.skipBlanks();
  72. m = inf.readInt(n-1, 100000000);inf.skipBlanks();
  73. k = inf.readInt(1, n);inf.skipBlanks();
  74. t = inf.readInt();inf.skipBlanks();
  75. A = inf.readInt();inf.skipBlanks();
  76. s = inf.readInt(1, n);inf.skipBlanks();
  77. --s;
  78.  
  79. for(int i = 0; i < m; ++i)
  80. {
  81. int x, y, w;
  82. x = inf.readInt(1, n);inf.skipBlanks();
  83. y = inf.readInt(1, n);inf.skipBlanks();
  84. w = inf.readInt(0, 1000000000);inf.skipBlanks();
  85. --x;
  86. --y;
  87. g[x][y] = w;
  88. g[y][x] = w;
  89. }
  90. {
  91. //
  92. int uk = 0;
  93. for(int i = 0; i < k; ++i)
  94. {
  95. castles[uk] = inf.readInt();inf.skipBlanks();
  96. a[uk] = inf.readInt();inf.skipBlanks();
  97. b[uk] = inf.readInt();inf.skipBlanks();
  98. c[uk] = inf.readInt();inf.skipBlanks();
  99. --castles[uk];
  100. cas[castles[uk]] = 1;
  101. if (!(a[uk] <= 0 && b[uk] <= 0)) ++uk;
  102. }
  103. k = uk;
  104. }
  105. inf.skipBlanks();
  106. inf.readEof();
  107. int coinsa = ans.readInt();ans.skipBlanks();
  108. ans.readEof();
  109. int coinsp = 0;
  110. int cA = A, ct = t, v = s;
  111. int q = ouf.readInt(0, maxq);
  112. ouf.skipBlanks();
  113. for(int i = 0; i < q; ++i)
  114. {
  115. int type = ouf.readInt(1, 2);
  116. ouf.skipBlanks();
  117. if (type == 2)
  118. {
  119. if (!cas[v])
  120. quitf(_wa, "Try to capture the '%d'-th field", v + 1); else
  121. if (used[v])
  122. quitf(_wa, "Two or more times a '%d' castle is captured", v + 1);
  123. else
  124. {
  125. if (cA < c[v])
  126. quitf(_wa, "Haven't '%d' warriors for capture castle '%d'", c[v] - cA, v + 1);
  127. cA += a[v];
  128. coinsp += b[v];
  129. }
  130. used[v] = 1;
  131. }
  132. else
  133. {
  134. int to = ouf.readInt(1, n);
  135. --to;
  136. if (g[v].count(to) == 0) quitf(_wa, "Haven't an edge from '%d' to '%d'", v + 1, to + 1);
  137. if (ct + g[v][to] > t) quitf(_wa, "Time is out on the action'%d'", i + 1);
  138. ct += g[v][to];
  139. v = to;
  140. }
  141. ouf.skipBlanks();
  142. }
  143. ouf.readEof();
  144. if (coinsa < coinsp)
  145. quitf(_fail, "Bad author sultion");
  146. quitp(score(coinsp, coinsa), "jr='%d' ur='%d'", coinsa, coinsp);
  147. return 0;
  148. }
  149.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:10: fatal error: testlib.h: No such file or directory
 #include "testlib.h"
          ^~~~~~~~~~~
compilation terminated.
stdout
Standard output is empty