結果

問題 No.2845 Birthday Pattern in Two Different Calendars
ユーザー Aging1986Aging1986
提出日時 2024-08-23 21:34:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,385 bytes
コンパイル時間 2,597 ms
コンパイル使用メモリ 210,636 KB
実行使用メモリ 13,668 KB
最終ジャッジ日時 2024-08-23 21:34:36
合計ジャッジ時間 6,944 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 AC 130 ms
13,544 KB
testcase_03 AC 118 ms
13,544 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 60 ms
10,728 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 93 ms
11,500 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 18 ms
7,168 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 195 ms
13,668 KB
testcase_22 AC 85 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<pdd> vpdd;
typedef vector<vd> vvd;
#define yn(ans) printf("%s\n", (ans)?"Yes":"No");
#define YN(ans) printf("%s\n", (ans)?"YES":"NO");
    template<class T> bool chmax(T &a, T b) {
	if (a >= b) return false;
	a = b; return true;
}
template<class T> bool chmin(T &a, T b) {
	if (a <= b) return false;
	a = b; return true;
}
#define FOR(i, s, e, t) for ((i) = (s); (i) < (e); (i) += (t)) 
#define REP(i, e) for (int i = 0; i < (e); ++i) 
#define REP1(i, s, e) for (int i = (s); i < (e); ++i)
#define RREP(i, e) for (int i = (e); i >= 0; --i)
#define RREP1(i, e, s) for (int i = (e); i >= (s); --i)
#define all(v) v.begin(), v.end()
#define pb push_back
#define qb pop_back
#define pf push_front
#define qf pop_front
#define maxe max_element
#define mine min_element
ll inf = 1e18;
#define DEBUG printf("%d\n", __LINE__); fflush(stdout);
template<class T> void print(vector<T> &v, bool withSize = false) {
	if (withSize) cout << v.size() << endl;
	REP(i, v.size()) cout << v[i] << " "; 
	cout << endl;
}
mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

int __FAST_IO__ = []() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	std::cout.tie(0);
	return 0;
}();

#define TESTS int t; cin >> t; while (t--)
#define TEST 
int main() {
    TESTS {
    	int K, M, N;
    	cin >> K >> M >> N;
    	
    	if (M == 1) {
    	    yn(false);
    	    continue;
    	}
    	vpii ans;
    	set<int> s;
    	for (int i = 1; i <= K; i += 2 * M - 2) {
    	    for (int j = 0; j < M - 1 && i + j <= K; ++j) {
    	        if (s.count(i + j)) continue;
    	        int k = (i + j + M - 2) % K + 1;
    	        if (!s.count(k)) ans.pb({i + j, k}), s.insert(i + j), s.insert(k);
    	    }
    	}
    	
    	if (ans.size() >= N) {
    	    yn(true);
    	    REP(i, N) printf("%d ", ans[i]); printf("\n"); 
    	} else {
    	    yn(false);
    	}
    }
    
    return 0;
}


0