Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Problem: E - LISDL
- // Contest: AtCoder - AtCoder Regular Contest 091
- // URL: https://atcoder.jp/contests/arc091/tasks/arc091_c
- // Memory Limit: 256 MB
- // Time Limit: 2000 ms
- //
- // Powered by CP Editor (https://cpeditor.org)
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- #define dbg(...) logger(#__VA_ARGS__, __VA_ARGS__)
- template <typename... Args> void logger(string vars, Args &&... values)
- {
- cerr << vars << " = ";
- string delim = "";
- (..., (cerr << delim << values, delim = ", "));
- cerr << endl;
- }
- template <class T> inline auto vv(int m) { return vector<vector<T>>(m, vector<T>(m)); }
- template <class T> inline auto vv(int m, int n) { return vector<vector<T>>(m, vector<T>(n)); }
- template <class T, T init> inline auto vv(int m) { return vector<vector<T>>(m, vector<T>(m, init)); }
- template <class T, T init> inline auto vv(int m, int n) { return vector<vector<T>>(m, vector<T>(n, init)); }
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- using ll = long long;
- using pii = pair<int, int>;
- using vl = vector<ll>;
- using vi = vector<int>;
- int main(int argc, char **argv)
- {
- ll n, a, b;
- cin >> n >> a >> b;
- if (a + b > n + 1 || a * b < n) {
- cout << -1 << endl;
- return 0;
- }
- vi ans;
- /*
- for (int i = b; i <= n; i += b) {
- for (int j = i; j > i - b; --j) {
- ans.push_back(j);
- }
- }
- if (ans.size() < n) {
- int rem = n - ans.size();
- for (int i = 0; i < rem; ++i) {
- ans.push_back(n - i);
- }
- }
- */
- int i = 0;
- for (a--; a >= 0; a--) {
- int sz = min(b, n - a);
- for (int j = i + sz; j > i; j--) {
- ans.push_back(j);
- }
- i += sz;
- n -= sz;
- }
- for (auto x : ans)
- cout << x << ' ';
- cout << endl;
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement