fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define all(x) begin(x), end(x)
  6. mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  7.  
  8. const int maxn = 2555, sigma = 4;
  9. int dp[maxn][maxn][sigma];
  10.  
  11. int get(char c) {
  12. return c == 'R' ? 0 : c == 'G' ? 1 : 2;
  13. }
  14.  
  15. class StringTransformation {
  16. public:
  17. string getResult(string s, string t) {
  18. int n = s.size();
  19. int m = t.size();
  20. dp[0][0][0] = dp[0][0][1] = dp[0][0][2] = dp[0][0][3] = 1;
  21. for(int i = 1; i <= n; i++) {
  22. for(int j = 1; j <= m; j++) {
  23. if(s[i - 1] == t[j - 1]) {
  24. int c = get(s[i - 1]);
  25. dp[i][j][3] = dp[i - 1][j - 1][c];
  26. }
  27. for(int tc = 0; tc <= 2; tc++) {
  28. dp[i][j][tc] = dp[i][j][3];
  29. if(i >= 3 && get(s[i - 3]) != tc) {
  30. dp[i][j][tc] |= dp[i - 2][j][tc];
  31. }
  32. }
  33. }
  34. }
  35. return dp[n][m][3] ? "YES" : "NO";
  36. }
  37. } me;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty