Submission #488828

# Submission time Handle Problem Language Result Execution time Memory
488828 2021-11-20T15:21:12 Z Wayne_Yan Newspapers (CEOI21_newspapers) C++17
8 / 100
2 ms 332 KB
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef int64_t ll;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define RF(n) RFi(i,n)
#define RFi(i,n) RFl(i,0,n)
#define RFl(i,l,n) for(int i=n-1;i>=l;i--)
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define sort_uni(v) sort(begin(v),end(v)),v.erase(unique(begin(v),end(v)),end(v))
#define mem(v,x) memset(v,x,sizeof v)
#define ff first
#define ss second
#define mid ((l+r)>>1)
#define RAN(a,b) uniform_int_distribution<int> (a, b)(rng)

template <typename T> using max_heap = __gnu_pbds::priority_queue<T,less<T> >;
template <typename T> using min_heap = __gnu_pbds::priority_queue<T,greater<T> >;
template <typename T> using rbt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int maxN = 1010;
vector<int> edges[maxN];

signed main(){
  
  int n,m;
  cin >> n >> m;
  F(m){
    int x,y;
    cin >> x >> y;
    edges[x].pb(y);
    edges[y].pb(x);
  }
  if(n == 1){
    printf("YES\n1\n1");
    exit(0);
  }
  if(n == 2){
    printf("YES\n2\n1 1");
    exit(0);
  }
  if(m == n-1){
    bool chain = true;
    Fl(i, 1, n+1){
      if(edges[i].size() > 2){
        chain = false;
        break;
      }
    }  

    if(chain){
      printf("YES\n");
      printf("%d\n", 2 * (n-2));
      F(n-2) printf("%d ", i+2);
      if(n%2 == 0) RF(n-2) printf("%d ", i+2);
      else F(n-2) printf("%d ", i+2);


    }else{
      printf("YES\n1\n1"); 
    }
    
  }else{
    printf("NO\n");
  }
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
6 Partially correct 1 ms 204 KB Failed to provide a successful strategy.
7 Correct 0 ms 204 KB Output is correct
8 Partially correct 1 ms 204 KB Failed to provide a successful strategy.
9 Incorrect 1 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
6 Partially correct 1 ms 204 KB Failed to provide a successful strategy.
7 Correct 0 ms 204 KB Output is correct
8 Partially correct 1 ms 204 KB Failed to provide a successful strategy.
9 Incorrect 1 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -