QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#278277#7875. Queue SortinglifanCompile Error//C++141.3kb2023-12-07 14:33:392023-12-07 14:33:42

Judging History

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

  • [2023-12-07 14:33:42]
  • 评测
  • [2023-12-07 14:33:39]
  • 提交

answer

// Becoder Submission #(result) => {
        console.log(result);
      } @ 1701930816996
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define op(x) ((x&1)?x+1:x-1)
#define odd(x) (x&1)
#define even(x) (!odd(x))
#define lc(x) (x<<1)
#define rc(x) (lc(x)|1)
#define lowbit(x) (x&-x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
using namespace std;
const int MAXN = 510,mod = 998244353;
void add(ll& x,ll y){x=(x+y)%mod;}
ll addv(ll x,ll y){return (x+y)%mod;}
//
ll n,a[MAXN],dp[MAXN][MAXN],s;
ll C[MAXN*2][MAXN*2];

int main(){
	rep(i,0,1000){
		C[i][0]=1;
		rep(j,1,i)C[i][j]=addv(C[i-1][j-1],C[i-1][j]);
	}

	cin>>n;
	rep(i,1,n)cin>>a[i];
	s=1;
	while(s<=n && !a[s])s++;
	if(s==n+1)return (cout<<"1\n"),0;

	ll sum=a[s];
	dp[s][0]=1; 
	rep(i,s+1,n){
		if(!a[i]){
			memcpy(dp[i],dp[i-1],sizeof dp[i]);
			continue;
		}
		rep(j,0,sum)if(dp[i-1][j]){
			ll val=dp[i-1][j];
			add(dp[i][j],val);
			rep(k,0,a[i]-1){ //枚举最后一格放的个数	
				ll r=a[i]-k;
				rep(p,j,sum-1){
					ll x=p-j+1,w=C[x+r-2][r-1];
					add(dp[i][p+r],val*w);
				}
			}
		}
		sum+=a[i];
	}

	ll ans=0;
	rep(i,0,sum)add(ans,dp[n][i]);
	cout<<ans<<endl;

    return 0;
}

Details

answer.code:3:9: error: stray ‘@’ in program
    3 |       } @ 1701930816996
      |         ^
answer.code:2:9: error: ‘console’ does not name a type
    2 |         console.log(result);
      |         ^~~~~~~
answer.code:3:7: error: expected declaration before ‘}’ token
    3 |       } @ 1701930816996
      |       ^
answer.code:3:11: error: expected unqualified-id before numeric constant
    3 |       } @ 1701930816996
      |           ^~~~~~~~~~~~~
In file included from /usr/include/c++/11/cmath:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:4:
/usr/include/c++/11/ext/type_traits.h:162:35: error: ‘bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/11/ext/type_traits.h:157:5: note: previous declaration ‘template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)’
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/11/ext/type_traits.h:162:26: error: ‘nullptr_t’ is not a member of ‘std’
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/11/bits/exception_ptr.h:40,
                 from /usr/include/c++/11/exception:147,
                 from /usr/include/c++/11/ios:39,
                 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:4:
/usr/include/c++/11/new:126:26: error: declaration of ‘operator new’ as non-function
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/11/new:126:44: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  126 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
      |                                            time_t
/usr/include/c++/11/new:127:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  127 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/11/new:128:26: error: declaration of ‘operator new []’ as non-function
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/11/new:128:46: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
      |                                              time_t
/usr/include/c++/11/new:129:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  129 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/11/new:135:34: error: ‘std::size_t’ has not been declared
  135 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                                  ^~~~~~
/usr/include/c++/11/new:137:36: error: ‘std::size_t’ has not been declared
  137 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                                    ^~~~~~
/usr/include/c++/11/new:140:26: error: declaration of ‘operator new’ as non-function
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/11/new:140:44: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
      |                                            time_t
/usr/include/c++/11/new:140:52: error: expected primary-expression before ‘const’
  140 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/11/new:142:26: error: declaration of ‘operator new []’ as non-function
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/11/new:142:46: error: ‘size_t’ is not a member of ‘std’; did you mean ‘time_t’?
  142 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
      |                                              time_t
/usr/include/c++/11/new:142:54: error: expected primary-e...