QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297254 | #6309. Aqre | georgeyucjr | Compile Error | / | / | C++20 | 5.0kb | 2024-01-04 08:43:22 | 2024-01-04 08:43:23 |
Judging History
answer
# include <bits/stdc++.h>
# if __cplusplus >= 201100LL
# else
# error Please use C++11 Or Higher CPP version
# endif
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using arr3 = std :: array < int, 3 >;
using arr4 = std :: array < int, 4 >;
using pii = std :: pair < int, int >;
# if __cplusplus >= 201400LL
# define rep(i, f, t, ...) for ( std :: decay < decltype ( f + t ) > :: type i = f, ##__VA_ARGS__; i <= t; ++i )
# define red(i, f, t, ...) for ( std :: decay < decltype ( f + t ) > :: type i = f, ##__VA_ARGS__; i >= t; --i )
# else
# define rep(i, f, t, ...) for ( decltype ( f + t ) i = f, ##__VA_ARGS__; i <= t; ++i )
# define red(i, f, t, ...) for ( decltype ( f + t ) i = f, ##__VA_ARGS__; i >= t; --i )
# endif
# define emb emplace_back
# define pb push_back
# define mkp make_pair
# define FILEIO(filename) freopen(filename ".in", "r", stdin), freopen(filename ".out", "w", stdout)
# define ALL( vc ) vc.begin ( ), vc.end ( )
# ifndef INLINE_V
# if __cplusplus >= 201700LL
# define INLINE_V inline
# else
# define INLINE_V
# endif
# endif
# if __cplusplus >= 202000LL
template < class T >
requires ( std :: is_signed_v < T > && std :: is_integral_v < T > )
INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1;
# elif __cplusplus >= 201400LL
template < class T, std :: enable_if < std :: is_integral_v < T > || std :: is_signed_v < T > || std :: is_same_v < std :: decay_t < T > , i128 > || std :: is_same_v < std :: decay < T > , u128 > *= nullptr > >
INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1;
# else
template < class T >
INLINE_V constexpr static T inf = std :: numeric_limits < T > :: max ( ) >> 1;
# endif
bool Mst;
# if __cplusplus >= 201400LL
# define EXPR constexpr
# define CPP14_ENABLE_IF enable_if
# else
# define EXPR
# endif
template < typename T, typename U >
inline EXPR auto ceil ( T && x, U && y ) {
return ( x > 0 ? ( x + y - 1 ) / y : x / y );
}
template < typename T, typename U >
inline EXPR auto floor ( T && x, U && y ) {
return ( x > 0 ? x / y : ( x - y + 1 ) / y );
}
template < typename T, typename U >
inline EXPR auto divmod ( T && x, U && y ) {
auto && q = floor ( x, y );
return std :: pair { q, x - q * y };
}
# if __cplusplus >= 202000LL
template <std :: ranges::forward_range R>
inline constexpr auto Sum ( R && r ) {
return std :: accumulate ( std :: ranges :: begin ( r ), std :: ranges :: end ( r ), 0 );
}
template < std :: ranges :: forward_range R, typename T >
inline constexpr auto Sum ( R && r, T init) {
return std :: accumulate ( std :: ranges :: begin ( r ), std :: ranges :: end ( r ), init );
}
# else
template < class R >
inline EXPR auto Sum ( R && r ) {
return std :: accumulate ( ALL ( r ), 0);
}
template < class R, typename T >
inline EXPR auto Sum( R && r, T init ) {
return std :: accumulate ( ALL ( r ), init );
}
template < class R >
inline EXPR auto Sum ( R f, R t ) {
return std ::accumulate ( f, t );
}
template < class R, typename T >
inline EXPR auto Sum ( R f, R t, T init ) {
return std :: accumulate ( f, t, init );
}
# endif
template < class T >
inline EXPR int SZ ( T && x ) { return std :: size ( x ); }
using namespace std;
# ifndef __GEORGEYUCJR_READ__
# ifdef LINUX
# include <georgeyucjr/debug.h>
using namespace georgeyucjr;
# else
# define write(...) void ( 36 )
# define bug(...) void ( 36 )
# endif
# else
# warning Do not use debug.hpp.
# endif
bool Med;
signed main() {
# ifndef __GEORGEYUCJR_READ__
ios_base :: sync_with_stdio ( false ), cin.tie ( nullptr ), cout.tie ( nullptr );
# endif
auto slv=[](){
int n,m;
cin>>n>>m;
vector<string>st(n+1,string(m+1));
vector<string>ans(n+1,string(m+1));
int ty=0;
if(n>m)swap(n,m),ty=1;
auto solve=[&st](int n,int m){
INLINE_V constexpr static int dt[][4]={{0,2,1,3},{0,1,3,2},{0,2,0}};
if(n<=3 && m<=3){
rep(i,1,n)fill(st[i]+1,st[i]+m+1,49);
}else if(n==2){
rep(i,1,n)rep(j,1,m)
st[i][j]=((dt[0][i-1]+j)%4!=0)+'0';
}else if(n==3){
rep(i,1,n)rep(j,1,m)st[i][j]=((dt[2][i-1]+j)%4!=0)+'0';
}else if(n>=4){
int typ=0;
if((n%4==2 && m%4==2) || (n%4==1 && m%4==1))typ=1;
rep(i,1,n)rep(j,1,m)st[i][j]=((dt[typ][(i-1)%4]+j)%4!=0)+'0';
}
}
solve(n,m);
int cnt=0;
rep(i,1,n)rep(j,1,m){
if(ty)ans[j][i]=st[i][j];
else ans[i][j]=st[i][j];
cnt+=st[i][j]-'0';
}
if(type)swap(n,m);
cout<<cnt<<endl;
rep(i,1,n){
ans[i][m+1]='\0';
cout<<(ans[i]+1)<<endl;
}
};int T;cin>>T;while(T--)slv();
# ifdef LOCAL
cerr << "Memory & Time Information : " << endl;
cerr << "Memory : " << ( ( & Med ) - ( & Mst ) ) * 1. / 1024. / 1024. << "MB" << endl;
cerr << "Time : " << clock ( ) * 1. / CLOCKS_PER_SEC * 1000. << "ms" << endl;
# endif
return 0;
}
Details
answer.code: In lambda function: answer.code:133:40: error: no matching function for call to ‘std::__cxx11::basic_string<char>::basic_string(int)’ 133 | vector<string>st(n+1,string(m+1)); | ^ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/basic_string.h:664:9: note: candidate: ‘template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ 664 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/11/bits/basic_string.h:664:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/11/bits/move.h:57, from /usr/include/c++/11/bits/stl_pair.h:59, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /usr/include/c++/11/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /usr/include/c++/11/bits/basic_string.h:125:8: required by substitution of ‘template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ /usr/include/c++/11/bits/basic_string.h:662:30: required from here /usr/include/c++/11/type_traits:2579:11: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’ 2579 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/basic_string.h:653:9: note: candidate: ‘template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ 653 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/11/bits/basic_string.h:653:9: note: template argument deduction/substitution failed: answer.code:133:40: note: candidate expects 4 arguments, 1 provided 133 | vector<string>st(n+1,string(m+1)); | ^ In file included from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, from /usr/include/c++/11/ios:42, from /usr/include/c++/11/istream:38, from /usr/include/c++/11/sstream:38, from /usr/include/c++/11/complex:45, from /usr/include/c++/11/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54, from answer.code:1: /usr/include/c++/11/bits/basic_string.h:638:9: note: candidate: ‘template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with _InputI...