Submission #576453

# Submission time Handle Problem Language Result Execution time Memory
576453 2022-06-13T06:20:10 Z temporary_juggernaut Newspapers (CEOI21_newspapers) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
    #define printl(args...)printf(args)
#else
    #define printl(args...)((void)0)
#endif
int main(){
	int n;
	cin>>n;
	if(n==1){
		puts("YES\n1\n1");
		return 0;
	}else if(n==2||n==3){
		puts("YES\n2\n2 2");
		return 0;
	}
	for(int i=1;i<n;i++)vec.push_back(i);
	if((vec.back()&1)==0)vec.pop_back();
	if((int)vec.back()&1)vec.push_back(1);
	for(int i=2;i<n;i++)vec.push_back(i);
	if(vec.back()&1)vec.pop_back();
	
	printf("YES\n%d\n",int(vec.size()));
	for(int to:vec)printf("%d ",to);
}

Compilation message

newspapers.cpp: In function 'int main()':
newspapers.cpp:30:22: error: 'vec' was not declared in this scope
   30 |  for(int i=1;i<n;i++)vec.push_back(i);
      |                      ^~~
newspapers.cpp:31:6: error: 'vec' was not declared in this scope
   31 |  if((vec.back()&1)==0)vec.pop_back();
      |      ^~~
newspapers.cpp:32:10: error: 'vec' was not declared in this scope
   32 |  if((int)vec.back()&1)vec.push_back(1);
      |          ^~~
newspapers.cpp:33:22: error: 'vec' was not declared in this scope
   33 |  for(int i=2;i<n;i++)vec.push_back(i);
      |                      ^~~
newspapers.cpp:34:5: error: 'vec' was not declared in this scope
   34 |  if(vec.back()&1)vec.pop_back();
      |     ^~~
newspapers.cpp:36:25: error: 'vec' was not declared in this scope
   36 |  printf("YES\n%d\n",int(vec.size()));
      |                         ^~~