답안 #488826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
488826 2021-11-20T15:14:14 Z Wayne_Yan Newspapers (CEOI21_newspapers) C++17
6 / 100
1 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) + (n%2 == 0));
      F(n-2) printf("%d ", i+2);
      if(n%2 == 0){
        printf("%d ", n-1);
      }
      F(n-2) printf("%d ", i+2);
    }else{
      printf("YES\n1\n1"); 
    }
    
  }else{
    printf("NO\n");
  }
  
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
6 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
7 Correct 0 ms 204 KB Output is correct
8 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
9 Incorrect 0 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
5 Correct 0 ms 204 KB Output is correct
6 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
7 Correct 0 ms 204 KB Output is correct
8 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
9 Correct 0 ms 204 KB Output is correct
10 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
11 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
12 Correct 1 ms 332 KB Output is correct
13 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
14 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
15 Correct 1 ms 332 KB Output is correct
16 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
17 Correct 1 ms 332 KB Output is correct
18 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
19 Correct 1 ms 332 KB Output is correct
20 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
6 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
7 Correct 0 ms 204 KB Output is correct
8 Partially correct 0 ms 204 KB Failed to provide a successful strategy.
9 Incorrect 0 ms 204 KB Output isn't correct
10 Halted 0 ms 0 KB -