Submission #1269538

#TimeUsernameProblemLanguageResultExecution timeMemory
1269538d1mkBrperm (RMI20_brperm)C++20
Compilation error
0 ms0 KiB
/// 407!3 +/ \!<07!\* #include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vpi = vector<pi>; using vpl = vector<pl>; using vpd = vector<pd>; using vvi = vector<vi>; using vvl = vector<vl>; using vvpi = vector<vpi>; template<class T> using pq = priority_queue<T>; template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>; // pairs #define mp make_pair #define f first #define s second // vectors #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) x.rbegin(), x.rend() #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define eb emplace_back #define pf push_front #define er erase #define ub upper_bound #define lb lower_bound // loops #define FOR(i,a,b) for (ll i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (ll i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) const int MOD = 1e9+7; // 998244353; const int MX = 2e5+5; const int LG = 20; const ll INF = 1e18; // not too close to LLONG_MAX const db PI = acos((db)-1); const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem! const char nl = '\n'; template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";} void _print() {cerr << "\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define ook order_of_key #define fbo find_by_order void _input() {return;} template <typename T, typename... V> void _input(T &t, V&... v) {cin >> (t); if (sizeof...(v)) _input(v...);} void __input(vi &v, const int n){F0R(i, n)cin >> v[i];} void __input(vvi &v, const int n, const int m){F0R(i, n)F0R(j, m)cin>>v[i][j];} ll binpow(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res; } char ss[500001]; int mx; vvpi precalc(LG); void init(int n, const char s[]) { mx = n; F0R(i, n)ss[i] = s[i]; F0R(i, LG){ F0R(x, (1 << i)){ ll j = 0, ci = x; F0R(z, i){ j *= 2; j += ci % 2; ci /= 2; } if(x < j)precalc[i].pb({x, j}); } } } int query(int i, int k) { ll n = (1 << k); if(i + n > mx)return 0; trav(el, precalc[k]){ if(ss[i + el.f] != ss[i + el.s])return 0; } return 1; } /// 407!3 +/ \!<07!\* #include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vpi = vector<pi>; using vpl = vector<pl>; using vpd = vector<pd>; using vvi = vector<vi>; using vvl = vector<vl>; using vvpi = vector<vpi>; template<class T> using pq = priority_queue<T>; template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>; // pairs #define mp make_pair #define f first #define s second // vectors #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) x.rbegin(), x.rend() #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define eb emplace_back #define pf push_front #define er erase #define ub upper_bound #define lb lower_bound // loops #define FOR(i,a,b) for (ll i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (ll i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) const int MOD = 1e9+7; // 998244353; const int MX = 2e5+5; const int LG = 20; const ll INF = 1e18; // not too close to LLONG_MAX const db PI = acos((db)-1); const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem! const char nl = '\n'; template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} void __print(unsigned long x) {cerr << x;} void __print(unsigned long long x) {cerr << x;} void __print(float x) {cerr << x;} void __print(double x) {cerr << x;} void __print(long double x) {cerr << x;} void __print(char x) {cerr << '\'' << x << '\'';} void __print(const char *x) {cerr << '\"' << x << '\"';} void __print(const string &x) {cerr << '\"' << x << '\"';} void __print(bool x) {cerr << (x ? "true" : "false");} template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';} template<typename T> void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";} void _print() {cerr << "\n";} template <typename T, typename... V> void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);} #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define ook order_of_key #define fbo find_by_order void _input() {return;} template <typename T, typename... V> void _input(T &t, V&... v) {cin >> (t); if (sizeof...(v)) _input(v...);} void __input(vi &v, const int n){F0R(i, n)cin >> v[i];} void __input(vvi &v, const int n, const int m){F0R(i, n)F0R(j, m)cin>>v[i][j];} ll binpow(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res = res * a; a = a * a; b >>= 1; } return res; } char ss[500001]; int mx; vvpi precalc(LG); void init(int n, const char s[]) { mx = n; F0R(i, n)ss[i] = s[i]; F0R(i, LG){ F0R(x, (1 << i)){ ll j = 0, ci = x; F0R(z, i){ j *= 2; j += ci % 2; ci /= 2; } if(x < j)precalc[i].pb({x, j}); } } } int query(int i, int k) { ll n = (1 << k); if(i + n > mx)return 0; trav(el, precalc[k]){ if(ss[i + el.f] != ss[i + el.s])return 0; } return 1; } /* */

Compilation message (stderr)

brperm.cpp:209:11: error: redefinition of 'const int MOD'
  209 | const int MOD = 1e9+7; // 998244353;
      |           ^~~
brperm.cpp:60:11: note: 'const int MOD' previously defined here
   60 | const int MOD = 1e9+7; // 998244353;
      |           ^~~
brperm.cpp:210:11: error: redefinition of 'const int MX'
  210 | const int MX = 2e5+5;
      |           ^~
brperm.cpp:61:11: note: 'const int MX' previously defined here
   61 | const int MX = 2e5+5;
      |           ^~
brperm.cpp:211:11: error: redefinition of 'const int LG'
  211 | const int LG = 20;
      |           ^~
brperm.cpp:62:11: note: 'const int LG' previously defined here
   62 | const int LG = 20;
      |           ^~
brperm.cpp:212:10: error: redefinition of 'const ll INF'
  212 | const ll INF = 1e18; // not too close to LLONG_MAX
      |          ^~~
brperm.cpp:63:10: note: 'const ll INF' previously defined here
   63 | const ll INF = 1e18; // not too close to LLONG_MAX
      |          ^~~
brperm.cpp:213:10: error: redefinition of 'const db PI'
  213 | const db PI = acos((db)-1);
      |          ^~
brperm.cpp:64:10: note: 'const db PI' previously defined here
   64 | const db PI = acos((db)-1);
      |          ^~
brperm.cpp:214:11: error: redefinition of 'const int dx [4]'
  214 | const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!
      |           ^~
brperm.cpp:65:11: note: 'const int dx [4]' previously defined here
   65 | const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!
      |           ^~
brperm.cpp:214:31: error: redefinition of 'const int dy [4]'
  214 | const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!
      |                               ^~
brperm.cpp:65:31: note: 'const int dy [4]' previously defined here
   65 | const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!
      |                               ^~
brperm.cpp:215:12: error: redefinition of 'const char nl'
  215 | const char nl = '\n';
      |            ^~
brperm.cpp:66:12: note: 'const char nl' previously defined here
   66 | const char nl = '\n';
      |            ^~
brperm.cpp:217:24: error: ambiguating new declaration 'template<class T> bool ckmin(T&, const T&)'
  217 | template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
      |                        ^~~~~
brperm.cpp:68:24: note: old declaration 'template<class T> bool ckmin(T&, const T&)'
   68 | template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
      |                        ^~~~~
brperm.cpp:218:24: error: ambiguating new declaration 'template<class T> bool ckmax(T&, const T&)'
  218 | template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
      |                        ^~~~~
brperm.cpp:69:24: note: old declaration 'template<class T> bool ckmax(T&, const T&)'
   69 | template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
      |                        ^~~~~
brperm.cpp:220:9: error: redefinition of 'std::mt19937 rng'
  220 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |         ^~~
brperm.cpp:71:9: note: 'std::mt19937 rng' previously declared here
   71 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |         ^~~
brperm.cpp:237:6: error: ambiguating new declaration 'template<class T, class V> void __print(const std::pair<_T1, _T2>&)'
  237 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
      |      ^~~~~~~
brperm.cpp:88:6: note: old declaration 'template<class T, class V> void __print(const std::pair<_T1, _T2>&)'
   88 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
      |      ^~~~~~~
brperm.cpp:239:6: error: ambiguating new declaration 'template<class T> void __print(const T&)'
  239 | void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
      |      ^~~~~~~
brperm.cpp:90:6: note: old declaration 'template<class T> void __print(const T&)'
   90 | void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
      |      ^~~~~~~
brperm.cpp:242:6: error: ambiguating new declaration 'template<class T, class ... V> void _print(T, V ...)'
  242 | void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
      |      ^~~~~~
brperm.cpp:93:6: note: old declaration 'template<class T, class ... V> void _print(T, V ...)'
   93 | void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
      |      ^~~~~~
brperm.cpp:256:6: error: ambiguating new declaration 'template<class T, class ... V> void _input(T&, V& ...)'
  256 | void _input(T &t, V&... v) {cin >> (t); if (sizeof...(v))  _input(v...);}
      |      ^~~~~~
brperm.cpp:107:6: note: old declaration 'template<class T, class ... V> void _input(T&, V& ...)'
  107 | void _input(T &t, V&... v) {cin >> (t); if (sizeof...(v))  _input(v...);}
      |      ^~~~~~
brperm.cpp:271:6: error: redefinition of 'char ss [500001]'
  271 | char ss[500001];
      |      ^~
brperm.cpp:122:6: note: 'char ss [500001]' previously declared here
  122 | char ss[500001];
      |      ^~
brperm.cpp:272:5: error: redefinition of 'int mx'
  272 | int mx;
      |     ^~
brperm.cpp:123:5: note: 'int mx' previously declared here
  123 | int mx;
      |     ^~
brperm.cpp:273:6: error: redefinition of 'vvpi precalc'
  273 | vvpi precalc(LG);
      |      ^~~~~~~
brperm.cpp:124:6: note: 'vvpi precalc' previously declared here
  124 | vvpi precalc(LG);
      |      ^~~~~~~