fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define FOR(i,l,r) for(int i = l; i<= r; i++)
  5. #define FORD(i,r,l) for(int i = r; i >= l; i--)
  6. #define MOD 998244353
  7. #define LINF 0x3f3f3f3f3f3f3f3f
  8. #define pb push_back
  9. #define fastIO ios::sync_with_stdio(0);cout.tie();cin.tie()
  10. #define fi first
  11. #define se second
  12. #define all(x) x.begin(),x.end()
  13. #define LG 20
  14. string a;
  15. int base = 311;
  16. int q;
  17. ll Hash[1000005];
  18. ll Pow[1000005];
  19. ll get(int l, int r){
  20. return (Hash[r]-Hash[l-1]*Pow[r-l+1]);
  21. }
  22. int main(){
  23. fastIO;
  24. cin>>a;
  25. int n = a.size();
  26. a = ' ' + a;
  27. Pow[0] = 1;
  28. FOR(i,1,n){
  29. Pow[i] = Pow[i-1]*base;
  30. }
  31. FOR(i,1,n){
  32. Hash[i] = (Hash[i-1]*base + a[i] - '0');
  33. }
  34. cin>>q;
  35. while(q--){
  36. int a,b,l;
  37. cin>>a>>b>>l;
  38. if(get(a,a+l) > get(b,b+l)){
  39. cout<<">"<<endl;
  40. }
  41. else if(get(a,a+l) < get(b,b+l)){
  42. cout<<"<"<<endl;
  43. }
  44. else{
  45. cout<<"="<<endl;
  46. }
  47. }
  48. }
  49.  
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty