#include <bits/stdc++.h>
using namespace std;
#ifdef evenvalue
#include "debug.h"
#define debug(...) print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...)
#endif
using int64 = long long;
using ld = long double;
template<typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;
namespace read {
int Int() {
int x;
cin >> x;
return x;
}
int64 Int64() {
int64 x;
cin >> x;
return x;
}
char Char() {
char c;
cin >> c;
return c;
}
string String() {
string s;
cin >> s;
return s;
}
double Double() {
return stod(String());
}
ld LongDouble() {
return stold(String());
}
template<typename T1, typename T2>
pair<T1, T2> Pair() {
pair<T1, T2> p;
cin >> p.first >> p.second;
return p;
}
template<typename T>
vector<T> Vec(const int n) {
vector<T> v(n);
for (T &x : v) {
cin >> x;
}
return v;
}
template<typename T>
vector<vector<T>> VecVec(const int n, const int m) {
vector<vector<T>> v(n);
for (vector<T> &vec : v) {
vec = Vec<T>(m);
}
return v;
}
}//namespace read
constexpr int kInf = 1e9 + 10;
constexpr int64 kInf64 = 1e15 + 10;
constexpr int kMod = 1e9 + 7;
constexpr int kMaxN = 2e5 + 10;
inline void solution() {
const int n = read::Int();
const int m = read::Int();
if (m != n - 1) {
cout << "NO\n";
return;
}
//subtask: stick
deque<int> ans;
for (int i = n - 1; i >= 2; i--) {
ans.push_front(i);
ans.push_back(i);
}
ans.push_front(2);
if (n == 1) {
ans = {1};
} else if (n == 2 or n == 3) {
ans = {2, 2};
}
cout << "YES\n";
cout << ans.size() << '\n';
for (const int x : ans) {
cout << x << ' ';
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
cout << fixed << setprecision(10);
int testcases = 1;
//cin >> testcases;
while (testcases--) {
solution();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
4 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
5 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Partially correct |
0 ms |
460 KB |
Provide a successful but not optimal strategy. |
5 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
6 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
7 |
Partially correct |
1 ms |
348 KB |
Provide a successful but not optimal strategy. |
8 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
9 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
10 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
11 |
Partially correct |
1 ms |
348 KB |
Provide a successful but not optimal strategy. |
12 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
13 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
14 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
15 |
Partially correct |
0 ms |
600 KB |
Provide a successful but not optimal strategy. |
16 |
Partially correct |
1 ms |
344 KB |
Provide a successful but not optimal strategy. |
17 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
18 |
Partially correct |
1 ms |
348 KB |
Provide a successful but not optimal strategy. |
19 |
Partially correct |
0 ms |
344 KB |
Provide a successful but not optimal strategy. |
20 |
Partially correct |
1 ms |
348 KB |
Provide a successful but not optimal strategy. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
4 |
Partially correct |
0 ms |
348 KB |
Provide a successful but not optimal strategy. |
5 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Partially correct |
0 ms |
348 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |