fork download
  1. #define ll long long
  2. #define MP make_pair
  3. #define MT make_tuple
  4. #define PB push_back
  5. #define X first
  6. #define Y second
  7. #define ALL(a) (a).begin(),(a).end()
  8. #define SZ(a) (a).size()
  9. #define LEN(s) (s).length()
  10. #define uset unordered_set
  11. #define umap unordered_map
  12. #define IT iterator
  13.  
  14. class TwoLLogo {
  15. public:
  16. long long countWays(vector <string> g) {
  17. ll i,j ,u,w, n = g.size(), m = g[0].size();
  18. vector<vector<pair<ll,ll> > > c(n, vector<pair<ll,ll>>(m, MP(0,0)));
  19. rp(i, 1, n) for (j = m - 2; j > -1; --j) if (g[i][j] =='.'){
  20. ll top = 0, right = 0;
  21. for (u = i-1; u > -1 && g[u][j] == '.'; --u) top++;
  22. for (w = j+1; w < m && g[i][w] == '.'; ++w) right++;
  23. c[i][j] = (top*right) ? MP(top, right) : MP(0,0);
  24. }
  25. ll ans = 0;
  26. ll part1=-1, part2=-1, shared=-1;
  27. for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) for (u = i; u < n; ++u) for (w = 0; w < m; ++w) if (i*n+j<= u*n+w && g[i][j] == '.' && g[u][w] == '.' && c[i][j] != MP(0, 0) && c[u][w] != MP(0, 0)){
  28. if (w>=j && u - c[u][w].X <= i && j + c[i][j].Y >= w) {
  29.  
  30. part1 = 1ll*c[i][j].X * c[i][j].Y * (max(u - i-1,0ll)) * c[u][w].Y;
  31. part2 = 1ll*c[i][j].X * (max(w - j-1,0ll)) * c[u][w].X * c[u][w].Y;
  32. shared = c[i][j].X * (max(w - j - 1, 0ll))*(max(u - i-1,0ll)) * c[u][w].Y;
  33. ans += part1 + part2 - shared;
  34. }
  35. else ans += c[i][j].X * c[i][j].Y * c[u][w].X * c[u][w].Y;
  36. }
  37.  
  38. return ans;
  39.  
  40. }
  41. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:16:22: error: ‘vector’ has not been declared
  long long countWays(vector <string> g) {
                      ^
prog.cpp:16:29: error: expected ‘,’ or ‘...’ before ‘<’ token
  long long countWays(vector <string> g) {
                             ^
prog.cpp: In member function ‘long long int TwoLLogo::countWays(int)’:
prog.cpp:17:20: error: ‘g’ was not declared in this scope
   ll i,j ,u,w, n = g.size(), m = g[0].size();
                    ^
prog.cpp:18:3: error: ‘vector’ was not declared in this scope
   vector<vector<pair<ll,ll> > > c(n, vector<pair<ll,ll>>(m, MP(0,0)));
   ^
prog.cpp:18:17: error: ‘pair’ was not declared in this scope
   vector<vector<pair<ll,ll> > > c(n, vector<pair<ll,ll>>(m, MP(0,0)));
                 ^
prog.cpp:1:12: error: expected primary-expression before ‘long’
 #define ll long long
            ^
prog.cpp:18:22: note: in expansion of macro ‘ll’
   vector<vector<pair<ll,ll> > > c(n, vector<pair<ll,ll>>(m, MP(0,0)));
                      ^
prog.cpp:1:12: error: expected ‘;’ before ‘long’
 #define ll long long
            ^
prog.cpp:18:22: note: in expansion of macro ‘ll’
   vector<vector<pair<ll,ll> > > c(n, vector<pair<ll,ll>>(m, MP(0,0)));
                      ^
prog.cpp:19:13: error: ‘rp’ was not declared in this scope
   rp(i, 1, n) for (j = m - 2; j > -1; --j) if (g[i][j] =='.'){
             ^
prog.cpp:19:15: error: expected ‘;’ before ‘for’
   rp(i, 1, n) for (j = m - 2; j > -1; --j) if (g[i][j] =='.'){
               ^
prog.cpp:19:33: warning: statement has no effect [-Wunused-value]
   rp(i, 1, n) for (j = m - 2; j > -1; --j) if (g[i][j] =='.'){
                                 ^
prog.cpp:19:42: error: expected ‘;’ before ‘)’ token
   rp(i, 1, n) for (j = m - 2; j > -1; --j) if (g[i][j] =='.'){
                                          ^
prog.cpp:27:43: error: ‘m’ was not declared in this scope
   for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) for (u = i; u < n; ++u) for (w = 0; w < m; ++w) if (i*n+j<= u*n+w && g[i][j] == '.' && g[u][w] == '.' && c[i][j] != MP(0, 0) && c[u][w] != MP(0, 0)){
                                           ^
prog.cpp:27:156: error: ‘c’ was not declared in this scope
   for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) for (u = i; u < n; ++u) for (w = 0; w < m; ++w) if (i*n+j<= u*n+w && g[i][j] == '.' && g[u][w] == '.' && c[i][j] != MP(0, 0) && c[u][w] != MP(0, 0)){
                                                                                                                                                            ^
prog.cpp:27:174: error: ‘make_pair’ was not declared in this scope
   for (i = 0; i < n; ++i) for (j = 0; j < m; ++j) for (u = i; u < n; ++u) for (w = 0; w < m; ++w) if (i*n+j<= u*n+w && g[i][j] == '.' && g[u][w] == '.' && c[i][j] != MP(0, 0) && c[u][w] != MP(0, 0)){
                                                                                                                                                                              ^
prog.cpp:30:57: error: ‘max’ was not declared in this scope
     part1 = 1ll*c[i][j].X * c[i][j].Y * (max(u - i-1,0ll)) * c[u][w].Y;
                                                         ^
stdout
Standard output is empty