QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#710954#8981. Kangaroo PuzzlexhytomCompile Error//C++233.1kb2024-11-04 23:27:022024-11-04 23:27:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 18:07:55]
  • hack成功,自动添加数据
  • (/hack/1130)
  • [2024-11-04 23:27:02]
  • 评测
  • [2024-11-04 23:27:02]
  • 提交

answer

/*
 
_/      _/    _/      _/    _/      _/   _/_/_/_/_/     _/_/       _/      _/ 
 _/    _/     _/      _/     _/    _/        _/       _/    _/     _/      _/            
  _/  _/      _/      _/      _/  _/         _/      _/      _/    _/_/  _/_/         
   _/_/       _/_/_/_/_/        _/           _/      _/      _/    _/  _/  _/          
  _/  _/      _/      _/        _/           _/      _/      _/    _/      _/          
 _/    _/     _/      _/        _/           _/       _/    _/     _/      _/          
_/      _/    _/      _/        _/           _/         _/_/       _/      _/       
 
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using i64 = long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define multi int _;cin>>_;while(_--)
#define int long long
#define pb push_back
#define eb emplace_back
ll gcd(ll a,ll b){ return b?gcd(b,a%b):a;}
mt19937_64 mrand(chrono::steady_clock().now().time_since_epoch().count());
int rnd(int l,int r){ return mrand() % (r - l + 1) + l;}
#ifdef localfreopen
#define debug(x) cerr << #x << " = " << (x) << endl;
void test() {cerr << "\n";}
template<typename T, typename... Args> 
void test(T x, Args... args) {cerr << x << " ";test(args...);}
#else
#define debug //
#define test //
#endif
const ll MOD = 998244353;
// const ll MOD = 1e9+7;
ll ksm(ll x,ll y){ll ans=1;x%=MOD;while(y){if(y&1)ans=ans*x%MOD;x=x*x%MOD,y/=2;}return ans;}

const int P1 = 972152273, base1 = 809;
const int P2 = 905563261, base2 = 919;
const ll N = 200005;
//head



signed main()
{  
#ifdef localfreopen
    // freopen("1.in","r",stdin);
#endif
    fastio
    std::cout << std::fixed << std::setprecision(10);
    int n, m;
    std::cin >> n >> m;

    std::vector is(n + 1, std::vector<int> (m + 2));
    for (int i = 1; i <= n; i++) {
        std::string s;
        std::cin >> s;
        for (int j = 0; j < m; j++) {
            is[i][j + 1] = s[j] - '0';
        }
    }

    std::string ans;

    std::vector<std::pair<int, int>> D = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
    std::vector<char> target = {'R', 'L', 'D', 'U'};
    auto dfs = [&](auto self, int x, int y, int fx, int fy, int rx, int ry, std::string s)->void{
        int cnt = 0;
        for (int k = 0; k < 4; k++) {
            auto [dx, dy] = D[k];
            int nx = x + dx, ny = y + dy;
            if (nx < 1 || nx > n || ny < 1 || ny > m || is[nx][ny] == 0 || (nx == fx && ny == fy)) continue;
            cnt++;
            self(self, nx, ny, x, y, rx, ry, s + target[k]);
        }
        if (cnt == 0) {
            ans += s;
        }
    };

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (is[i][j] == 1) {
                dfs(dfs, i, j, 0, 0, i, j, "");
            }
        }
    }

    while (ans.size() < 50000) ans += "LRDU"[rnd(0, 3)];
    assert(ans <= 50000);
    std::cout << ans << "\n";


    return 0;
}

Details

In file included from /usr/include/c++/13/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:106,
                 from answer.code:12:
answer.code: In function ‘int main()’:
answer.code:93:16: error: no match for ‘operator<=’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘int’)
   93 |     assert(ans <= 50000);
      |            ~~~ ^~ ~~~~~
      |            |      |
      |            |      int
      |            std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181:
/usr/include/c++/13/bits/regex.h:1288:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Alloc> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed)
 1288 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1288:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
/usr/include/c++/13/bits/regex.h:1456:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed)
 1456 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1456:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
/usr/include/c++/13/bits/regex.h:1629:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed)
 1629 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1629:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed)
  583 |     operator<=>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:583:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::reverse_iterator<_IteratorL>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ (reversed)
 1690 |     operator<=>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
In file included from /usr/include/c++/13/bits/ranges_algo.h:36,
                 from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/optional:1273:5: note: candidate: ‘template<class _Tp, class _Up>  requires  three_way_comparable_with<_Up, _Tp, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const optional<_Tp>&, const optional<_Up>&)’ (reversed)
 1273 |     operator<=>(const optional<_Tp>& __x, const optional<_Up>& __y)
      |     ^~~~~~~~
/usr/include/c++/13/optional:1273:5: note:   template argument deduction/substitution failed:
answer.code:93:19: note:   mismatched types ‘const std::optional<_Tp>’ and ‘int’
   93 |     assert(ans <= 50000);
      |                   ^~~~~
/usr/include/c++/13/optional:1288:5: note: candidate: ‘template<class _Tp> constexpr std::strong_ordering std::operator<=>(const optional<_Tp>&, nullopt_t)’ (reversed)
 1288 |     operator<=>(const optional<_Tp>& __x, nullopt_t) noexcept
      |     ^~~~~~~~
/usr/include/c++/13/op...