fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define endl '\n'
  5. #define ll long long
  6.  
  7. void IO(){
  8. #ifndef ONLINE_JUDGE
  9. freopen("input.txt", "r", stdin);
  10. freopen("output.txt", "w", stdout);
  11. #endif
  12. }
  13.  
  14. const int MOD = 1e9 + 7;
  15. const int N = 5e3 ;
  16.  
  17. vector<vector<int>> dp ( N , vector<int>(N));
  18.  
  19. string s ;
  20. void solve(int tc) {
  21.  
  22. cin >> s;
  23. int n = s.size() ;
  24. int q; cin >> q;
  25.  
  26.  
  27. vector<vector<int>> pal ( n , vector<int>( n ));
  28. for (int l = n -1 ; l>=0 ; l -- ) {
  29. for (int r = l ; r <n ; r ++ ) {
  30. if ( l == r ) {
  31. pal[l][r]=1 ;
  32. }
  33. else {
  34. pal[l][r] = s[l] == s[r] && pal[l + 1][r-1] ;
  35. }
  36. }
  37. }
  38.  
  39. while ( q -- ) {
  40. int l, r ; cin >> l >> r ;
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47. }
  48. int main(){
  49. ios::sync_with_stdio(false);
  50. cin.tie(nullptr);
  51.  
  52. IO();
  53.  
  54. int TC = 1;
  55. // cin >> TC;
  56.  
  57. for (int i = 1; i <= TC; i++) {
  58. solve(i);
  59. }
  60.  
  61. return 0;
  62. }
Success #stdin #stdout 0.05s 98600KB
stdin
Standard input is empty
stdout
Standard output is empty