Advertisement
ec1117

Untitled

Jun 26th, 2021
6,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.51 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.  
  195. void solve(){
  196.     set<int> sq, cbs;
  197.     For(i,100)sq.ins(i*i), cbs.ins(i*i*i);
  198.     For(i,2)For(j,2)For(k,2){
  199.         vi v;
  200.         FOR(l,13,1301){
  201.             if((l<500) ^ i){
  202.                 if(sq.count(l) ^ j){
  203.                     if(cbs.count(l) ^ k){
  204.                         v.pb(l);
  205.                     }
  206.                 }
  207.             }
  208.         }
  209.         dbg(sz(v),i,j,k);
  210.         if(sz(v)<=5)dbg(v);
  211.     }
  212. }
  213.  
  214. int main() {
  215.         setIO();
  216.         int t=1;
  217.         // re(t);
  218.         while(t--)solve();
  219.         // you should actually read the stuff at the bottom
  220. }
  221.  
  222. /* stuff you should look for
  223.         * int overflow, array bounds
  224.         * special cases (n=1?)
  225.         * do smth instead of nothing and stay organized
  226.         * WRITE STUFF DOWN
  227.         * DON'T GET STUCK ON ONE APPROACH
  228. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement