QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#397476#5438. Half MixedlifanCompile Error//C++141.6kb2024-04-24 10:24:412024-04-24 10:24:42

Judging History

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

  • [2024-04-24 10:24:42]
  • 评测
  • [2024-04-24 10:24:41]
  • 提交

answer

// 
dengziyue 
Logout
QOJ.ac
QOJ
 Contests
 Category
 Problems
 Submissions
 Hack!
Universal Cup
Search the problem set
ID	Problem	Submitter	Result	Time	Memory	Language	File size	Submit time	Judge time
#397475	#5438. Half Mixed	dengziyue	Judging	/	/	C++14	1.1kb	2024-04-24 10:23:47	2024-04-24 10:23:47
小熊像超人一样飞Judging Test #29
Judging History
 你现在查看的是最新测评结果

[2024-04-24 10:23:47]评测
测评结果:Judging用时:0ms内存:0kb
 查看
[2024-04-24 10:23:47]提交
answer
#include<bits/stdc++.h>
using namespace std;
#define max_n 1000000
int tid;
long long n;
long long m;
vector<long long>g;
bool ans[max_n+2];
void check(long long n,long long w){
	for(long long i=n;i>=1;--i){
		while(i*(i+1)/2<=w){
			if(w-i*(i+1)/2<n-i)break;
			g.push_back(i); n-=i; w-=i*(i+1)/2; 
		}
	}
}
int main(){
	scanf("%d",&tid);
	for(int ca=1;ca<=tid;++ca){
		scanf("%lld%lld",&n,&m);
		if((n*(n+1)*m*(m+1)/4)&1){printf("No\n"); continue;}
		printf("Yes\n");
		g.clear();
		if((n*(n+1)/2)%2==0){
			check(n,n*(n+1)/4);
			long long sum=0;
			bool now=1;
			for(auto u:g){
				for(long long i=sum+1;i<=sum+u;++i)ans[i]=now;
				sum+=u; now^=1;
			}
			for(int i=1;i<=n;++i){
				for(int j=1;j<=m;++j)printf("%d ",(int)ans[i]);printf("\n");
			}
		}
		else{
			check(m,m*(m+1)/4);
			long long sum=0;
			bool now=1;
			for(auto u:g){
				for(long long i=sum+1;i<=sum+u;++i)ans[i]=now;
				sum+=u; now^=1;
			}
			for(int i=1;i<=n;++i){
				for(int j=1;j<=m;++j)printf("%d ",(int)ans[j]);printf("\n");
			}
		}
	}
	return 0;
}

Details

answer.code:14:9: error: "#" is not a valid filename
   14 | #397475 #5438. Half Mixed       dengziyue       Judging /       /       C++14   1.1kb   2024-04-24 10:23:47     2024-04-24 10:23:47
      |         ^
answer.code:15:30: error: stray ‘#’ in program
   15 | 小熊像超人一样飞Judging Test #29
      |                              ^
answer.code:2:1: error: ‘dengziyue’ does not name a type
    2 | dengziyue
      | ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:24:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/cstddef:50,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:510:31: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                               ^~~~~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’?
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:443:29: note: ‘nullptr_t’ declared here
  443 |   typedef decltype(nullptr) nullptr_t;
      |                             ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/include/stddef.h:214:23: note: ‘size_t’ declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:57: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1357 ...