답안 #987489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
987489 2024-05-22T20:45:28 Z activedeltorre Semafor (COI20_semafor) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>

using namespace std;
long long nr1[2300];
long long nr2[2300];
long long nrbiti=10;
long long cif(long long val)
{
    if(val==1)
    {
        return 1;
    }
    else if(val==2)
    {
        return 6;
    }
    else if(val==3)
    {
        return 21;
    }
    else if(val==4)
    {
        return 9;
    }
    else if(val==5)
    {
        return 28;
    }
    else if(val==6)
    {
        return 18;
    }
    else if(val==7)
    {
        return 5;
    }
    else if(val==8)
    {
        return 30;
    }
    else if(val==9)
    {
        return 29;
    }
    else
        return 3;
}
long long getid(long long val)
{
    return cif(val/10)*32+cif(val%10);
}
long long mod=1e9+7;
long long nmax=1023;
struct kuk
{
    long long mat[105][105];
}m1,m2,m3;
long long invs(long long a,long long exp)
{
    long long prod=1;
    while(exp)
    {
        if(exp%2==1)
        {
            prod=(prod*a)%mod;
        }
        exp=exp/2;
        a=(a*a)%mod;
    }
    return prod;
}
long long stbs (long long oper,long long biti)
{
    ///oper+biti-1 luate cate biti
    ///(oper+9)!/9!*(oper-1)!
    long long rasp=1;
    for(long long i=oper+1;i<=oper+9;i++)
    {
        rasp=(rasp*(i%mod))%mod;
    }
    rasp=(rasp*invs(362880,mod-2))%mod;
    return rasp;
}
long long getvalk(long long x,long long oper)
{
    oper=oper-__builtin_popcount(x);
    if(oper<0 || oper%2==1)
    {
        return 0;
    }
    stbs(oper/2,nrbiti);
}
kuk calularemat(long long k)
{
    kuk rasp;
    long long i,j,xouus;
    for(i=0;i<=99;i++)
    {
        for(j=0;j<=99;j++)
        {
            xouus=getid(i)^getid(j);
            rasp.mat[i][j]=getvalk(xouus,k);
        }
    }
    return rasp;
}
signed main()
{
    long long n,i,j,k,l,m,st,val,z;
    cin>>m>>n>>k>>st;
    val=getid(st);
    nr1[val]=1;
    m1=calularemat(k);
 //   m2=calularemat(n%k);
    for(i=0;i<=99;i++)
    {
        cout<m1.mat[st][i]<<'\n';
    }
    return 0;
}

Compilation message

semafor.cpp: In function 'int main()':
semafor.cpp:117:13: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'long long int')
  117 |         cout<m1.mat[st][i]<<'\n';
      |         ~~~~^~~~~~~~~~~~~~~~~~~~
      |         |                 |
      |         |                 long long int
      |         std::ostream {aka std::basic_ostream<char>}
semafor.cpp:117:13: note: candidate: 'operator<(int, long long int)' (built-in)
  117 |         cout<m1.mat[st][i]<<'\n';
      |         ~~~~^~~~~~~~~~~~~~~~~~~~
semafor.cpp:117:13: note:   no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:489:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  489 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:489:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:366:5: note: candidate: 'template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  366 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:366:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:404:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  404 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:404:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1451 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note: candidate: 'template<class _Iterator> bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1507 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6267:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6267 |     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6267:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6280:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 6280 |     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6280:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6292:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6292 |     operator<(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6292:5: note:   template argument deduction/substitution failed:
semafor.cpp:117:29: note:   mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
  117 |         cout<m1.mat[st][i]<<'\n';
      |                             ^~~~
In file included from /usr/include/c++/10/bits/ios_base.h:46,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from semafor.cpp:1:
/usr/include/c++/10/system_error:252:3: note: candidate: 'bool std::operator<(const std::error_code&, const std::error_code&)'
  252 |   operator<(const error_code& __lhs, const error_code& __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/system_error:252:31: note:   no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_code&'
  252 |   operator<(const error_code& __lhs, const error_code& __rhs) noexcept
      |             ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/system_error:379:3: note: candidate: 'bool std::operator<(const std::error_condition&, const std::error_condition&)'
  379 |   operator<(const error_condition& __lhs,
      |   ^~~~~~~~
/usr/include/c++/10/system_error:379:36: note:   no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&'
  379 |   operator<(const error_condition& __lhs,
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
semafor.cpp:109:19: warning: unused variable 'j' [-Wunused-variable]
  109 |     long long n,i,j,k,l,m,st,val,z;
      |                   ^
semafor.cpp:109:23: warning: unused variable 'l' [-Wunused-variable]
  109 |     long long n,i,j,k,l,m,st,val,z;
      |                       ^
semafor.cpp:109:34: warning: unused variable 'z' [-Wunused-variable]
  109 |     long long n,i,j,k,l,m,st,val,z;
      |                                  ^
semafor.cpp: In function 'long long int getvalk(long long int, long long int)':
semafor.cpp:91:9: warning: control reaches end of non-void function [-Wreturn-type]
   91 |     stbs(oper/2,nrbiti);
      |     ~~~~^~~~~~~~~~~~~~~