結果
| 問題 | No.3477 Yet Another LIS Triangle |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-10-08 11:51:41 |
| 言語 | C++23(gnu拡張gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 4,730 bytes |
| 記録 | |
| コンパイル時間 | 1,882 ms |
| コンパイル使用メモリ | 295,936 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-10-08 11:52:06 |
| 合計ジャッジ時間 | 5,499 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 19 |
ソースコード
#ifdef MAIN
bool __multi__ = 1;
using INT = long long;
namespace XK {
void solve() {
ll N, K; rd(N, K);
// if(N == 3 && K == 2) {
// wt("Yes");
// wt("3 6 5");
// wt("5 1 4");
// wt("4 2 3");
// /*
// Yes
// 3 6 5
// 5 1 4
// 4 2 3
// */
// return;
// }
if(K == 1 || N == K) return wt("No");
wt("Yes");
V<ll> A(N), B(N), C(N);
rep(i, N) A[i] = i + 1;
rep(i, N) B[i] = N + i;
rep(i, N) C[i] = 2 * N + i - 1;
C.back() = 1;
int po = K + 1;
V<ll> a;
rep(i, N) {
a.pb(po ++);
if(po == N + 1) po = 1;
}
A.swap(a);
po = N + K;
V<ll> b;
rep(i, N) {
b.pb(po ++);
if(po == 2 * N) po = N;
}
B.swap(b);
rep(i, N) if(B[i] == N) B[i] = A.back(), swap(B[i], B[0]);
po = 2 * N + K - 2;
V<ll> c;
rep(i, N - 1) {
c.pb(po ++);
if(po == 3 * N - 2) po = 2 * N - 1;
}
C.swap(c);
C.pb(A[0]);
rep(i, N) if(C[i] == 2 * N - 1) C[i] = B.back(), swap(C[i], C[0]);
sort(A.begin(), A.end() - K); reverse(A.begin(), A.end() - K); C.back() = A[0];
sort(B.begin() + 1, B.end() - K + 1); reverse(B.begin() + 1, B.end() - K + 1);
sort(C.begin() + 1, C.end() - K + 1); reverse(C.begin() + 1, C.end() - K + 1);
wt(A); wt(B); wt(C);
}
};
#else
#include "cassert"
#include "cmath"
#include "cstdint"
#include "cstdio"
#include "cstdlib"
#include "cstring"
#include "algorithm"
#include "bitset"
#include "chrono"
#include "complex"
#include "deque"
#include "functional"
#include "iostream"
#include "limits"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "sstream"
#include "string"
#include "unordered_map"
#include "unordered_set"
#include "utility"
#include "vector"
#include "array"
using namespace std;
#define int long long
using ll = long long;
using ull = unsigned long long;
const ll INF = 1ll << 60;
const ll LINF = 0x1fffffffffffffff;
const ll MINF = 0x7fffffffffff;
template <class A, class B> bool chmax(A& l, const B& r){ return r > l ? l = r, 1 : 0; }
template <class A, class B> bool chmin(A& l, const B& r){ return r < l ? l = r, 1 : 0; }
#define sz(x) ssize(x)
#define rep(i, a) for(ll i = 0; i < (a); i ++)
#define Rep(i, a, b) for(ll i = (a); i < (b); i ++)
#define rrep(i, a, b) for(ll i = (b); i --> (a); )
#define all(x) begin(x), end(x)
template<class... Ts> void rd(Ts&... t);
[[maybe_unused]] void wtN(){}
template<class T, class... Ts> void wtN(const T& t, const Ts&... ts);
template<class... Ts> void wt(const Ts&... ts){ wtN(ts...); cout << '\n'; }
namespace IO{
#define VOID(a) decltype(void(a))
struct S{ S(){ cin.tie(nullptr)->sync_with_stdio(0); fixed(cout).precision(12); } }S;
template<int I> struct P : P<I-1>{};
template<> struct P<0>{};
template<class T> void i(T& t){ i(t, P<3>{}); }
void i(vector<bool>::reference t, P<3>){ int a; i(a); t = a; }
template<class T> auto i(T& t, P<2>) -> VOID(cin >> t){ cin >> t; }
template<class T> auto i(T& t, P<1>) -> VOID(begin(t)){ for(auto&& x : t) i(x); }
template<class T, size_t... idx> void ituple(T& t, index_sequence<idx...>){ in(get<idx>(t)...); }
template<class T> auto i(T& t, P<0>) -> VOID(tuple_size<T>{}){ ituple(t, make_index_sequence<tuple_size<T>::value>{}); }
template<class T> void o(const T& t){ o(t, P<4>{}); }
template<size_t N> void o(const char (&t)[N], P<4>){ cout << t; }
template<class T, size_t N> void o(const T (&t)[N], P<3>){ o(t[0]); for(size_t i = 1; i < N; i++){ o(' '); o(t[i]); } }
template<class T> auto o(const T& t, P<2>) -> VOID(cout << t){ cout << t; }
template<class T> auto o(const T& t, P<1>) -> VOID(begin(t)){ bool first = 1; for(auto&& x : t) { if(first) first = 0; else o(' '); o(x); } }
template<class T, size_t... idx> void otuple(const T& t, index_sequence<idx...>){ wtN(get<idx>(t)...); }
template<class T> auto o(T& t, P<0>) -> VOID(tuple_size<T>{}){ otuple(t, make_index_sequence<tuple_size<T>::value>{}); }
#undef VOID
}
template<class... Ts> void rd(Ts&... t){ (IO::i(t), ...); }
template<class T, class... Ts> void wtN(const T& t, const Ts&... ts){ IO::o(t); (IO::o((cout << ' ', ts)), ...); }
#undef unpack
constexpr ll debug_const(ll judge, ll debug) {
#ifdef DEBUG
return debug;
#else
return judge;
#endif
}
#ifdef DEBUG
ll __lg(ull x){ return 63 - __builtin_clzll(x); }
#define debug(...) { wtN(#__VA_ARGS__); wtN(":"); wt(__VA_ARGS__); }
#else
#define debug(...) void(0)
#endif
#define fst first
#define snd second
#define pb push_back
template<class T> using V = vector<T>;
template<class T, std::size_t N> using AR = array<T, N>;
#define MAIN
#include __FILE__
signed main() {int t = 1;if(__multi__) cin >> t;while(t --) XK::solve();}
#endif