QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#850818#8355. T3Wanye#Compile Error//C++142.5kb2025-01-10 12:02:572025-01-10 12:02:59

Judging History

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

  • [2025-01-10 12:02:59]
  • 评测
  • [2025-01-10 12:02:57]
  • 提交

answer

#include<bits/stdc++.h>
#define N 305
using namespace std;
int n,u[N],d[N],l[N],r[N],i,sum,maps[N][N];
vector<pair<char,int> > ans;
inline void change(int pos,int type,int &tx,int &ty){
    if(type==0){
        for(int i=1;i<=n;i++){
            if(!maps[i][pos]){
                maps[i][pos]=1,tx=i,ty=pos;
                return ;
            }
        }
    }
    if(type==1){
        for(int i=n;i>=1;i--){
            if(!maps[i][pos]){
                maps[i][pos]=1,tx=i,ty=pos;
                return ;
            }
        }
    }
    if(type==2){
        for(int i=1;i<=n;i++){
            if(!maps[pos][i]){
                maps[pos][i]=1,tx=pos,ty=i;
                return ;
            }
        }
    }
    if(type==3){
        for(int i=n;i>=1;i--){
            if(!maps[pos][i]){
                maps[pos][i]=1,tx=pos,ty=i;
                return ;
            }
        }
    }
}
inline void dfs(int step){
    if(step>sum){
        for(int i=0;i<ans.size();i++) cout<<ans[i].first<<ans[i].second<<endl;
        exit(0);
        return ;
    }
    for(int i=1;i<=n;i++){
        if(u[i]){
            int tx = -1,ty = -1;
            change(i,0,tx,ty);
            if(tx==-1) continue;
            u[i]--,ans.push_back(make_pair('U',i)),dfs(step+1);
            u[i]++,ans.pop_back(),maps[tx][ty]=0;
        }
    }
    for(int i=1;i<=n;i++){
        if(d[i]){
            int tx = -1,ty = -1;
            change(i,1,tx,ty);
            if(tx==-1) continue;
            d[i]--,ans.push_back(make_pair('D',i)),dfs(step+1);
            d[i]++,ans.pop_back(),maps[tx][ty]=0;
        }
    }
    for(int i=1;i<=n;i++){
        if(l[i]){
            int tx = -1,ty = -1;
            change(i,2,tx,ty);
            if(tx==-1) continue;
            l[i]--,ans.push_back(make_pair('L',i)),dfs(step+1);
            l[i]++,ans.pop_back(),maps[tx][ty]=0;
        }
    }
    for(int i=1;i<=n;i++){
        if(r[i]){
            int tx = -1,ty = -1;
            change(i,3,tx,ty);
            if(tx==-1) continue;
            r[i]--,ans.push_back(make_pair('R',i)),dfs(step+1);
            r[i]++,ans.pop_back(),maps[tx][ty]=0;
        }
    }
}
int main(){
	ios::sync_with_stdio(false);
    cin>>n;
    for(i=1;i<=n;i++) cin>>u[i],sum+=u[i];
    for(i=1;i<=n;i++) cin>>d[i],sum+=d[i];
    for(i=1;i<=n;i++) cin>>l[i],sum+=l[i];
    for(i=1;i<=n;i++) cin>>r[i],sum+=r[i];
    if(n<=3){
        dfs(1);
        return 0;
    }
    cout<<"NO"<endl;
    return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:94:15: error: no match for ‘operator<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’)
   94 |     cout<<"NO"<endl;
      |     ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1143:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)’
 1143 |     operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1143:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1224:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)’
 1224 |     operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1224:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1317:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’
 1317 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1317:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1391:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)’
 1391 |     operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1391:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   couldn’t deduce template parameter ‘_Bi_iter’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1485:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’
 1485 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1485:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1560:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)’
 1560 |     operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1560:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   couldn’t deduce template parameter ‘_Bi_iter’
   94 |     cout<<"NO"<endl;
      |                ^~~~
/usr/include/c++/13/bits/regex.h:1660:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’
 1660 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1660:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   94 |     cout<<"NO"<endl;
      |                ^~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 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_pair.h:835:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’
  835 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:835:5: note:   template argument deduction/substitution failed:
answer.code:94:16: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::pair<_T1, _T2>’
   94 |     cout<<"...