結果
| 問題 | No.3548 SigMax Digits (Construction ver.) |
| コンテスト | |
| ユーザー |
zawakasu
|
| 提出日時 | 2026-05-22 23:04:45 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,513 bytes |
| 記録 | |
| コンパイル時間 | 1,627 ms |
| コンパイル使用メモリ | 213,404 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-22 23:04:48 |
| 合計ジャッジ時間 | 2,451 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 6 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <tuple>
#include <ranges>
#include <random>
// #include "Src/Number/IntegerDivision.hpp"
// #include "Src/Utility/BinarySearch.hpp"
// #include "Src/Sequence/CompressedSequence.hpp"
// #include "Src/Sequence/RunLengthEncoding.hpp"
// #include "Src/Algebra/Group/AdditiveGroup.hpp"
// #include "Src/DataStructure/FenwickTree/FenwickTree.hpp"
// #include "Src/DataStructure/SegmentTree/SegmentTree.hpp"
// #include "Src/DataStructure/DisjointSetUnion/DisjointSetUnion.hpp"
// #include "Src/DataStructure/Heap/BinaryHeap.hpp"
namespace zawa {}
using namespace zawa;
// #include "atcoder/modint"
// using mint = atcoder::modint998244353;
// #include <array>
// #include <bit>
// #include <bitset>
// #include <climits>
// #include <cmath>
// #include <set>
// #include <unordered_set>
// #include <map>
// #include <unordered_map>
// #include <optional>
// #include <queue>
// #include <stack>
// #include <deque>
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
using namespace std;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
for (int i = 0 ; i < ssize(v) ; i++)
os << v[i] << (i + 1 == ssize(v) ? "" : " ");
return os;
}
/*
* むずそう。
* mod 9でうまくできない?
* 1,1,2,3,4,5,6,7,8,9
* 2,2,2,3,4,5,6,7,8,9
* 3,3,3,3,4,5,6,7,8,9
* ...
* 8,8,8,8,8,8,8,8,8,9
* 9,9,9,9,9,9,9,9,9,9
* みたいな列の繰り返しは簡単に作れる
* 8が良い説あるか?9でちょっとずらすができる。
*
* 99999...らへんから調整する方針
* できていないのが
* - 3,12,21,30,39
* - 5,14,23,32,41
* - 6,15,24,...,
* - 8,..
* 定数個なんだよな。
* こいつらにはmod9調整ができないって話だから、あんまり嬉しくないか。
*
* 同じことを例えば599999,60000,60001,...とかで探すとか?
*/
int main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(20);
#if !defined DEBUG
vector<tuple<int,long long,long long>> FIN(9,{-1,-1,-1});
const int SEARCH = 1000;
for (int i = 1 ; i <= 9 ; i++) {
long long st = (long long)i * (long long)1e17;
int v = 0;
for (int j = 0 ; j < SEARCH ; j++,st++) {
int x = 0;
for (char c : to_string(st))
x = max(x,c-'0');
v += x;
if (FIN[v%9] == tuple{-1,-1,-1} or get<0>(FIN[v%9])>v/9)
FIN[v%9] = {v/9,st-j,st};
}
}
// for (int i = 0 ; i < 9 ; i++)
// cout << get<0>(FIN[i]) << ' ' << get<2>(FIN[i]) << endl;
int T;
cin >> T;
while (T--) {
long long n;
cin >> n;
long long need = n/9;
long long L = get<1>(FIN[n%9])-need, R = get<2>(FIN[n%9]);
cout << L << ' ' << R << '\n';
}
#else
mt19937_64 mt{random_device{}()};
for (int testcase = 0 ; ; ) {
cerr << "----------" << ++testcase << "----------" << endl;
auto a = solve(), b = naive();
if (a != b) {
// print testcase
cerr << "you: " << a << endl;
cout << "correct: " << b << endl;
exit(0);
}
}
#endif
}
zawakasu