Submission #41608197


Source Code Expand

#include<bits/stdc++.h>
#define re register
#define int long long
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int t,n,m,a[1000002],ans,R[1000002],stk[1000002],tp;
char s[1000002];
struct node{
	int l,r;
	bool operator <(const node A)const{return l<A.l;}
};
vector<node>A,B;
signed main(){
	n=read(),m=read();
	for(re int i=1;i<=n;++i)a[i]=read();
	sort(a+1,a+n+1);
	A.push_back((node){0,0});
	for(re int i=1;i<=n;++i){
		int o=A.size();
		for(re int j=0;j<o;++j)A.push_back((node){A[j].l+a[i],A[j].r+a[i]});
		sort(A.begin(),A.end());
		re int l=A[0].l,r=A[0].r;
		for(re int j=0;j<A.size();++j){
			if(A[j].l<=r+1)r=max(r,A[j].r);
			else B.push_back((node){l,r}),l=A[j].l,r=A[j].r;
		}B.push_back((node){l,r}),A=B,B.clear();
		while(A.size()>200000)A.pop_back();
	}
	re int lst=0;
	for(re int i=1;i<A.size();++i)
		for(re int j=A[i-1].r+1;j<A[i].l&&m;++j)
			printf("%lld ",j),m--;
	for(re int i=A[A.size()-1].r+1;m;++i)printf("%lld ",i),--m;
}


Submission Info

Submission Time
Task C - Mex of Subset Sum
User gyh20
Language C++ (GCC 9.2.1)
Score 800
Code Size 1106 Byte
Status AC
Exec Time 584 ms
Memory 17800 KiB

Compile Error

./Main.cpp: In function ‘long long int read()’:
./Main.cpp:6:9: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    6 |  re int t=0;re char v=getchar();
      |         ^
./Main.cpp:6:21: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    6 |  re int t=0;re char v=getchar();
      |                     ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:20:13: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   20 |  for(re int i=1;i<=n;++i)a[i]=read();
      |             ^
./Main.cpp:23:13: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   23 |  for(re int i=1;i<=n;++i){
      |             ^
./Main.cpp:25:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   25 |   for(re int j=0;j<o;++j)A.push_back((node){A[j].l+a[i],A[j].r+a[i]});
      |              ^
./Main.cpp:27:10: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   27 |   re int l=A[0].l,r=A[0].r;
      |          ^
./Main.cpp:27:19: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   27 |   re int l=A[0].l,r=A[0].r;
      |                   ^
./Main.cpp:28:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   28 |   for(re int j=0;j<A.size();++j){
      |              ^
./Main.cpp:28:19: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<node>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   28 |   for(re int j=0;j<A.size();++j){
      |                  ~^~~~~~~~~
./Main.cpp:29:33: warning: address requested for ‘r’, which is declared ‘register’ [-Wextra]
   29 |    if(A[j].l<=r+1)r=max(r,A[j].r);
      |                                 ^
./Main.cpp:34:9: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   34 |  re int lst=0;
  ...

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 800 / 800
Status
AC × 2
AC × 69
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_rand1_01.txt, 01_rand1_02.txt, 01_rand1_03.txt, 01_rand1_04.txt, 01_rand1_05.txt, 01_rand1_06.txt, 01_rand1_07.txt, 01_rand1_08.txt, 01_rand1_09.txt, 01_rand1_10.txt, 01_rand1_11.txt, 01_rand1_12.txt, 01_rand1_13.txt, 01_rand1_14.txt, 01_rand1_15.txt, 01_rand1_16.txt, 01_rand1_17.txt, 01_rand1_18.txt, 01_rand1_19.txt, 01_rand1_20.txt, 01_rand1_21.txt, 01_rand1_22.txt, 01_rand1_23.txt, 01_rand1_24.txt, 01_rand1_25.txt, 01_rand1_26.txt, 01_rand1_27.txt, 01_rand1_28.txt, 01_rand1_29.txt, 01_rand1_30.txt, 01_rand1_31.txt, 01_rand1_32.txt, 01_rand1_33.txt, 02_rand2_01.txt, 02_rand2_02.txt, 02_rand2_03.txt, 02_rand2_04.txt, 02_rand2_05.txt, 02_rand2_06.txt, 02_rand2_07.txt, 02_rand2_08.txt, 02_rand2_09.txt, 02_rand2_10.txt, 02_rand2_11.txt, 02_rand2_12.txt, 02_rand2_13.txt, 02_rand2_14.txt, 02_rand2_15.txt, 02_rand2_16.txt, 02_rand2_17.txt, 03_rand3_01.txt, 03_rand3_02.txt, 03_rand3_03.txt, 03_rand3_04.txt, 03_rand3_05.txt, 03_rand3_06.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt, 04_handmade_04.txt, 04_handmade_05.txt, 04_handmade_06.txt, 04_handmade_07.txt, 04_handmade_08.txt, 04_handmade_09.txt, 04_handmade_10.txt, 04_handmade_11.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 7 ms 3636 KiB
00_sample_02.txt AC 2 ms 3636 KiB
01_rand1_01.txt AC 2 ms 3656 KiB
01_rand1_02.txt AC 2 ms 3600 KiB
01_rand1_03.txt AC 2 ms 3512 KiB
01_rand1_04.txt AC 5 ms 3564 KiB
01_rand1_05.txt AC 3 ms 3592 KiB
01_rand1_06.txt AC 3 ms 3540 KiB
01_rand1_07.txt AC 5 ms 3564 KiB
01_rand1_08.txt AC 3 ms 3704 KiB
01_rand1_09.txt AC 3 ms 3652 KiB
01_rand1_10.txt AC 3 ms 3744 KiB
01_rand1_11.txt AC 2 ms 3572 KiB
01_rand1_12.txt AC 3 ms 3676 KiB
01_rand1_13.txt AC 4 ms 3648 KiB
01_rand1_14.txt AC 5 ms 3628 KiB
01_rand1_15.txt AC 3 ms 3564 KiB
01_rand1_16.txt AC 6 ms 3692 KiB
01_rand1_17.txt AC 3 ms 3660 KiB
01_rand1_18.txt AC 4 ms 3700 KiB
01_rand1_19.txt AC 3 ms 3664 KiB
01_rand1_20.txt AC 3 ms 3600 KiB
01_rand1_21.txt AC 10 ms 3664 KiB
01_rand1_22.txt AC 12 ms 3684 KiB
01_rand1_23.txt AC 10 ms 3832 KiB
01_rand1_24.txt AC 11 ms 3636 KiB
01_rand1_25.txt AC 15 ms 3744 KiB
01_rand1_26.txt AC 14 ms 3956 KiB
01_rand1_27.txt AC 103 ms 5732 KiB
01_rand1_28.txt AC 106 ms 5780 KiB
01_rand1_29.txt AC 103 ms 5248 KiB
01_rand1_30.txt AC 12 ms 3872 KiB
01_rand1_31.txt AC 10 ms 3724 KiB
01_rand1_32.txt AC 14 ms 3876 KiB
01_rand1_33.txt AC 9 ms 3680 KiB
02_rand2_01.txt AC 184 ms 15704 KiB
02_rand2_02.txt AC 165 ms 16152 KiB
02_rand2_03.txt AC 188 ms 16832 KiB
02_rand2_04.txt AC 184 ms 17376 KiB
02_rand2_05.txt AC 207 ms 17668 KiB
02_rand2_06.txt AC 208 ms 15720 KiB
02_rand2_07.txt AC 210 ms 16824 KiB
02_rand2_08.txt AC 215 ms 17648 KiB
02_rand2_09.txt AC 216 ms 17616 KiB
02_rand2_10.txt AC 206 ms 17788 KiB
02_rand2_11.txt AC 198 ms 17148 KiB
02_rand2_12.txt AC 4 ms 3812 KiB
02_rand2_13.txt AC 2 ms 3604 KiB
02_rand2_14.txt AC 7 ms 3760 KiB
02_rand2_15.txt AC 5 ms 3764 KiB
02_rand2_16.txt AC 3 ms 3724 KiB
02_rand2_17.txt AC 4 ms 3616 KiB
03_rand3_01.txt AC 120 ms 5632 KiB
03_rand3_02.txt AC 118 ms 5796 KiB
03_rand3_03.txt AC 121 ms 5796 KiB
03_rand3_04.txt AC 52 ms 4724 KiB
03_rand3_05.txt AC 54 ms 4764 KiB
03_rand3_06.txt AC 55 ms 4744 KiB
04_handmade_01.txt AC 2 ms 3648 KiB
04_handmade_02.txt AC 95 ms 4360 KiB
04_handmade_03.txt AC 90 ms 4564 KiB
04_handmade_04.txt AC 160 ms 5980 KiB
04_handmade_05.txt AC 164 ms 6036 KiB
04_handmade_06.txt AC 86 ms 4572 KiB
04_handmade_07.txt AC 148 ms 5736 KiB
04_handmade_08.txt AC 27 ms 4756 KiB
04_handmade_09.txt AC 2 ms 3532 KiB
04_handmade_10.txt AC 379 ms 17736 KiB
04_handmade_11.txt AC 584 ms 17800 KiB