正文
增加 35 行删除 35 行
5 行未改动6789101112131459 行未改动747576777879808182838485868788899091929394959629 行未改动1261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042055 行未改动005 int sign[N]{};006 int n,m,p,vis[N],tag[N];007 using std::vector;008 vector<int>a[N];009010 void init(){011 scanf("%d%d",&n,&p);012 for(int i=1;i<=n;i++) vis[i]=0;013 }59 行未改动073 while( ( tmp<=n ) && ( (!con&&tmp==nums) || (con&&tmp==rem) ) || (sign[tmp]) ){074 if(tmp<=n) tmp+=p;075 else break;076 }077 if(tmp<=n&&!sign[tmp]) found=1;078 if(con==1)079 {080 if(found){081 std::cout<<tmp<<" ";082 sign[tmp]=1;083 rem=tmp;084 cnt+=1;085 continue;086 }087 con=0;088 rem=-1;089 }090 else{091 if(nums<=n&&found)092 {093 std::cout<<nums<<" "<<tmp<<" ";094 sign[nums]=1;095 sign[tmp]=1;29 行未改动```对于所有输入数据,保证$1 \leq n \leq 10^5$,$1 \leq p \leq 10^8$,$1 \leq T \leq 10^4$,$1 \leq \sum n \leq 3\times 10^5$。### 判断题1.对于任意合法数据,solve1和solve2的输出一般是相同的( )2.对于任意合法数据,solve1都能在1s内给出答案。( )3.对于任意合法数据,solve2都能在1s内给出答案。( )### 选择题4.对于以下输入数据:```39 15 21 12345```solve1的输出为( )A.```3 8 7 1 4 5 6 9 21 5 3 2 41```B.```1 2 3 4 5 6 7 8 92 4 1 3 51```C.```1 2 3 4 5 6 7 8 91 3 5 2 41```D.```1 2 3 4 5 6 7 8 95 3 1 4 21```5.对于以下输入数据:```39 15 21 12345```solve2的输出为( )A.```3 8 7 1 4 5 6 9 21 5 3 2 41```B.```1 2 3 4 5 6 7 8 92 4 1 3 51```C.```1 2 3 4 5 6 7 8 91 3 5 2 41```D.```1 2 3 4 5 6 7 8 95 3 1 4 21```6.以下哪项一定是对solve1的描述( )A.使用了数组作为元素是否出现的标记。B.只要是合法的输入,程序最终能给出合法的解。C.使用了更大的空间来存储数据并处理。D.在不同规模的数据规模下都有稳定的时间消耗。参考答案:× √ × B C D5 行未改动6789101112131459 行未改动747576777879808182838485868788899091929394959629 行未改动1261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042055 行未改动005 int sign[N]{};006 int n,m,p,vis[N],tag[N];007 using std::vector;008 vector<int>a[N];009010 void init(){011 scanf("%d%d",&n,&p);012 for(int i=1;i<=n;i++) vis[i]=0;013 }59 行未改动073 while( ( tmp<=n ) && ( (!con&&tmp==nums) || (con&&tmp==rem) ) || (sign[tmp]) ){074 if(tmp<=n) tmp+=p;075 else break;076 }077 if(tmp<=n&&!sign[tmp]) found=1;078 if(con==1)079 {080 if(found){081 std::cout<<tmp<<" ";082 sign[tmp]=1;083 rem=tmp;084 cnt+=1;085 continue;086 }087 con=0;088 rem=-1;089 }090 else{091 if(nums<=n&&found)092 {093 std::cout<<nums<<" "<<tmp<<" ";094 sign[nums]=1;095 sign[tmp]=1;29 行未改动```对于所有输入数据,保证$1 \leq n \leq 10^5$,$1 \leq p \leq 10^8$,$1 \leq T \leq 10^4$,$1 \leq \sum n \leq 3\times 10^5$。### 判断题1.对于任意合法数据,solve1和solve2的输出一般是相同的( )2.对于任意合法数据,solve1都能在1s内给出答案。( )3.对于任意合法数据,solve2都能在1s内给出答案。( )### 选择题4.对于以下输入数据:```39 15 21 12345```solve1的输出为( )A.```3 8 7 1 4 5 6 9 21 5 3 2 41```B.```1 2 3 4 5 6 7 8 92 4 1 3 51```C.```1 2 3 4 5 6 7 8 91 3 5 2 41```D.```1 2 3 4 5 6 7 8 95 3 1 4 21```5.对于以下输入数据:```39 15 21 12345```solve2的输出为( )A.```3 8 7 1 4 5 6 9 21 5 3 2 41```B.```1 2 3 4 5 6 7 8 92 4 1 3 51```C.```1 2 3 4 5 6 7 8 91 3 5 2 41```D.```1 2 3 4 5 6 7 8 95 3 1 4 21```6.以下哪项一定是对solve1的描述( )A.使用了数组作为元素是否出现的标记。B.只要是合法的输入,程序最终能给出合法的解。C.使用了更大的空间来存储数据并处理。D.在不同规模的数据规模下都有稳定的时间消耗。参考答案:× √ × B C D