ec1117

Untitled

Jun 26th, 2021
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.35 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6. typedef long double ld;
  7. typedef double db;
  8. typedef string str;
  9.  
  10. typedef pair<int,int> pi;
  11. typedef pair<pi, int> pii;
  12. typedef pair<ll,ll> pl;
  13. typedef pair<db,db> pd;
  14.  
  15. typedef vector<int> vi;
  16. typedef vector<bool> vb;
  17. typedef vector<ll> vl;
  18. typedef vector<db> vd;
  19. typedef vector<str> vs;
  20. typedef vector<pi> vpi;
  21. typedef vector<pl> vpl;
  22. typedef vector<pd> vpd;
  23. template<class T> using V = vector<T>;
  24. template<class T, size_t SZ> using AR = array<T,SZ>;
  25.  
  26. #define mp make_pair
  27. #define f first
  28. #define s second
  29. #define sz(x) (int)(x).size()
  30. #define all(x) begin(x), end(x)
  31. #define rall(x) (x).rbegin(), (x).rend()
  32. #define sor(x) sort(all(x))
  33. #define revs(x) reverse(all(x))
  34. #define rsz resize
  35. #define ins insert
  36. #define ft front()
  37. #define bk back()
  38. #define pf push_front
  39. #define pb push_back
  40. #define eb emplace_back
  41. #define lb lower_bound
  42. #define ub upper_bound
  43.  
  44. #define FOR(i,a,b) for (int i = (a); i < (b); ++i)
  45. #define F0R(i,a) FOR(i,0,a)
  46. #define For(i,a) FOR(i,0,a)
  47. #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
  48. #define R0F(i,a) ROF(i,0,a)
  49. #define Rof(i,a) ROF(i,0,a)
  50. #define trav(a,x) for (auto& a: x)
  51.  
  52. template<class T> bool ckmin(T& a, const T& b) {
  53.         return b < a ? a = b, 1 : 0; }
  54. template<class T> bool ckmax(T& a, const T& b) {
  55.         return a < b ? a = b, 1 : 0; }
  56. constexpr int pct(int x) { return __builtin_popcount(x); }
  57. constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))
  58. ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
  59. ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
  60. ll half(ll x) { return fdiv(x,2); }
  61.  
  62. template<class T, class U> T fstTrue(T lo, T hi, U f) {
  63.         // note: if (lo+hi)/2 is used instead of half(lo+hi) then this will loop infinitely when lo=hi
  64.         hi ++; assert(lo <= hi); // assuming f is increasing
  65.         while (lo < hi) { // find first index such that f is true
  66.                 T mid = half(lo+hi);
  67.                 f(mid) ? hi = mid : lo = mid+1;
  68.         }
  69.         return lo;
  70. }
  71. template<class T, class U> T lstTrue(T lo, T hi, U f) {
  72.         lo --; assert(lo <= hi); // assuming f is decreasing
  73.         while (lo < hi) { // find first index such that f is true
  74.                 T mid = half(lo+hi+1);
  75.                 f(mid) ? lo = mid : hi = mid-1;
  76.         }
  77.         return lo;
  78. }
  79. template<class T> void remDup(vector<T>& v) {
  80.         sort(all(v)); v.erase(unique(all(v)),end(v)); }
  81.  
  82. // INPUT
  83. template<class A> void re(complex<A>& c);
  84. template<class A, class B> void re(pair<A,B>& p);
  85. template<class A> void re(vector<A>& v);
  86. template<class A, size_t SZ> void re(array<A,SZ>& a);
  87.  
  88. template<class T> void re(T& x) { cin >> x; }
  89. void re(db& d) { str t; re(t); d = stod(t); }
  90. void re(ld& d) { str t; re(t); d = stold(t); }
  91. template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
  92.  
  93. template<class A> void re(complex<A>& c) { A a,b; re(a,b); c = {a,b}; }
  94. template<class A, class B> void re(pair<A,B>& p) { re(p.f,p.s); }
  95. template<class A> void re(vector<A>& x) { trav(a,x) re(a); }
  96. template<class A, size_t SZ> void re(array<A,SZ>& x) { trav(a,x) re(a); }
  97.  
  98. // TO_STRING
  99. #define ts to_string
  100. str ts(char c) { return str(1,c); }
  101. str ts(const char* s) { return (str)s; }
  102. str ts(str s) { return s; }
  103. str ts(bool b) {
  104.         #ifdef LOCAL
  105.                 return b ? "true" : "false";
  106.         #else
  107.                 return ts((int)b);
  108.         #endif
  109. }
  110. template<class A> str ts(complex<A> c) {
  111.         stringstream ss; ss << c; return ss.str(); }
  112. str ts(vector<bool> v) {
  113.         str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);
  114.         res += "}"; return res; }
  115. template<size_t SZ> str ts(bitset<SZ> b) {
  116.         str res = ""; F0R(i,SZ) res += char('0'+b[i]);
  117.         return res; }
  118. template<class A, class B> str ts(pair<A,B> p);
  119. template<class T> str ts(T v) { // containers with begin(), end()
  120.         #ifdef LOCAL
  121.                 bool fst = 1; str res = "{";
  122.                 for (const auto& x: v) {
  123.                         if (!fst) res += ", ";
  124.                         fst = 0; res += ts(x);
  125.                 }
  126.                 res += "}"; return res;
  127.         #else
  128.                 bool fst = 1; str res = "";
  129.                 for (const auto& x: v) {
  130.                         if (!fst) res += " ";
  131.                         fst = 0; res += ts(x);
  132.                 }
  133.                 return res;
  134.  
  135.         #endif
  136. }
  137. template<class A, class B> str ts(pair<A,B> p) {
  138.         #ifdef LOCAL
  139.                 return "("+ts(p.f)+", "+ts(p.s)+")";
  140.         #else
  141.                 return ts(p.f)+" "+ts(p.s);
  142.         #endif
  143. }
  144.  
  145. // OUTPUT
  146. template<class A> void pr(A x) { cout << ts(x); }
  147. template<class H, class... T> void pr(const H& h, const T&... t) {
  148.         pr(h); pr(t...); }
  149. void ps() { pr("\n"); } // print w/ spaces
  150. template<class H, class... T> void ps(const H& h, const T&... t) {
  151.         pr(h); if (sizeof...(t)) pr(" "); ps(t...); }
  152.  
  153. // DEBUG
  154. void DBG() { cerr << "]" << endl; }
  155. template<class H, class... T> void DBG(H h, T... t) {
  156.         cerr << ts(h); if (sizeof...(t)) cerr << ", ";
  157.         DBG(t...); }
  158. #ifdef LOCAL // compile with -DLOCAL, chk -> fake assert
  159.         #define dbg(...) cerr << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
  160.         #define chk(...) if (!(__VA_ARGS__)) cerr << "Line(" << __LINE__ << ") -> function(" \
  161.                  << __FUNCTION__  << ") -> CHK FAILED: (" << #__VA_ARGS__ << ")" << "\n", exit(0);
  162. #else
  163.         #define dbg(...) 0
  164.         #define chk(...) 0
  165. #endif
  166.  
  167. int gcd(int a, int b) {if (b == 0)return a;return gcd(b, a % b);}
  168. int max(int a,int b, int c){return max(a,max(b,c));}
  169. int min(int a,int b, int c){return min(a,min(b,c));}
  170. ll max(ll a,ll b, ll c){return max(a,max(b,c));}
  171. ll min(ll a,ll b, ll c){return min(a,min(b,c));}
  172. void dbga(int arr[], int n){vi v;For(i,n)v.pb(arr[i]);dbg(v);}
  173. void dbga(ll arr[], int n){vi v;For(i,n)v.pb(arr[i]);dbg(v);}
  174.  
  175. // FILE I/O
  176. void setIn(str s) { freopen(s.c_str(),"r",stdin); }
  177. void setOut(str s) { freopen(s.c_str(),"w",stdout); }
  178. void unsyncIO() { cin.tie(0)->sync_with_stdio(0); }
  179. void setIO(str s = "") {
  180.         unsyncIO();
  181.         // cin.exceptions(cin.failbit);
  182.         // throws exception when do smth illegal
  183.         // ex. try to read letter into int
  184.         if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
  185. }
  186. // 576743 29995400689069LL
  187. const int MOD = 1e9+7; // 998244353;
  188. const int MX = 3e5+5;
  189. const ll INF = 1e18;
  190. const ld PI = acos((ld)-1);
  191. const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};
  192. mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
  193.  
  194. db eps=0.0000001;
  195.  
  196. bool eq(db a, db b){
  197.     return abs(a-b)<eps;
  198. }
  199.  
  200. //2.4 * 10^9
  201. void solve(){
  202.     vi jobs;
  203.     For(i,4)jobs.pb(i);
  204.     //bill paul vinton larisa
  205.     //alg, trig, ana, calc
  206.     vector<db> x;
  207.     for(db i=19;i<=29.0;i+=0.10){
  208.         for(db j=19;j<=29.0;j+=0.10){
  209.             for(db k=19;k<=29.0;k+=0.10){
  210.                 for(db l=19;l<=29.0;l+=0.10){
  211.                     while(next_permutation(all(jobs))){
  212.                         x={i,j,k,l};
  213.                         if(x[1]>x[0]){//paul paid more than bill
  214.                             if(eq(x[jobs[3]]-x[jobs[1]],3.0)){//trig is $3 less than calc
  215.                                 if(eq(x[1],1.25*(x[jobs[2]]-2))){
  216.                                     // assert(false);
  217.                                     if(eq(x[jobs[1]],1.08*x[2])){
  218.                                         ps("HI");
  219.                                         ps(x);
  220.                                         ps(jobs);
  221.                                         cout<<endl;
  222.                                         // assert(false);
  223.                                     }
  224.                                 }
  225.                             }
  226.                         }
  227.                     }
  228.                 }
  229.             }
  230.         }
  231.     }
  232. }
  233.  
  234. int main() {
  235.         setIO();
  236.         int t=1;
  237.         // re(t);
  238.         while(t--)solve();
  239.         // you should actually read the stuff at the bottom
  240. }
  241.  
  242. /* stuff you should look for
  243.         * int overflow, array bounds
  244.         * special cases (n=1?)
  245.         * do smth instead of nothing and stay organized
  246.         * WRITE STUFF DOWN
  247.         * DON'T GET STUCK ON ONE APPROACH
  248. */
Advertisement
Add Comment
Please, Sign In to add comment