結果

問題 No.3448 ABBBBBBBBC
コンテスト
ユーザー kenene
提出日時 2026-03-01 17:47:57
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 817 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,958 ms
コンパイル使用メモリ 337,064 KB
実行使用メモリ 15,012 KB
最終ジャッジ日時 2026-03-01 18:54:36
合計ジャッジ時間 12,974 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define int long long
using namespace std;

void solve(){
	int n, k;
	cin >> n >> k;
	int sum1 = 72 * n;
	int a = (k - 1) / sum1 + 1;
	k = (k - 1) % sum1 + 1;
	
	vector<int > num;
	for(int i = 0; i <= 9; i++)
		if(i != a)
			num.push_back(i);
	int sum2 = 8 * n;
	int idb = (k - 1) / sum2;
	int b = num[idb];
	k = (k - 1) % sum2 + 1;
	
	int ci = 0;
	while(1){
		int last = n - 1 - ci;
		for(int i : num){
			int cnt;
			if(i == b){
				if(last > 0)	cnt = 8 * last;
				else 	cnt = 0;
			}
			else cnt = 1;
			if(k <= cnt){
				if(i == b){
					ci++;break;
				}
				else{
					int len = 3 + ci;
					cout << len << " " << a << " " << b << " " << i << endl;
					return;
				}
			}
			else k -= cnt;
		}
	}
}
signed main()
{
    int t;
    cin >> t;
    while (t--)
    	solve();
    return 0;
}
0