結果
| 問題 | No.3548 SigMax Digits (Construction ver.) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-22 22:44:31 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 126 ms / 2,000 ms |
| コード長 | 2,869 bytes |
| 記録 | |
| コンパイル時間 | 3,170 ms |
| コンパイル使用メモリ | 352,712 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-22 22:44:51 |
| 合計ジャッジ時間 | 7,512 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define srep(i,l,r) for(ll i=l;i<=r;i++)
#define irep(i,r,l) for(ll i=r;i>=l;i--)
using ll = long long;
using ld = long double;
const ll mod=998244353;
#define vout(v) for(auto i :v) cout<<i<<" "; cout<<nl;
#define INF 9223300000000000000ll
#define Winf 5e12
#define nl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vl vector<ll>
#define pb push_back
#define vc vector<char>
#define vb vector<bool>
#define uniq(x) sort((x).begin(),(x).end());(x).erase(unique((x).begin(),(x).end()),(x).end())
#define eb emplace_back
void no(void) { cout<<"No"<<nl;}
void yes(void) {cout<<"Yes"<<nl;}
void yn(bool a) {
cout<<(a ? "Yes":"No")<<nl;
}
vector<ll> dx={-1,0,1,0,1,1,-1,-1};
vector<ll> dy={0,-1,0,1,-1,1,-1,1};
bool isin(ll i,ll j,ll h,ll w) {
if(i<0 || i>=h || j<0 || j>=w) return false;
return true;
}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<class T>T vecmax(const vector<T>&v){return *max_element(all(v));}
template<class T>T vecmin(const vector<T>&v){return *min_element(all(v));}
ll safemod(ll num,ll rule) {
return (num%rule+rule)%rule;
}
ll sum(vector<ll> &a) {
return accumulate(all(a),0ll);
}
template<class T>void vvpr(vector<vector<T>> g) {
rep(i,g.size()) {
rep(j,g[i].size()) {
cout<<g[i][j]<<(j==g[i].size()-1 ? "\n":" ");
}
}
}
#define MOD 998244353
template<class T> T modpow(T fl, ll po, ll mode) { // mode: 0=modなし, 1=modあり
assert(po>=0);
T ret(1);
if (mode) {
fl%=T(MOD);
while (po>0) {
if (po&1) ret=(ret*fl)%T(MOD);
fl=(fl*fl)%T(MOD);
po>>=1;
}
} else {
while (po>0) {
if(po&1) ret*=fl;
fl*=fl;
po>>=1;
}
}
return ret;
}
int main() {
ll t; cin>>t;
vl f={0,1,2,3,4,5,6,7,8,9,1,1,2,3,4,5,6,7,8,9,2,2,2,3};
vl ansl={-1,1,2,1,4,2,1,3,8,2,1,5,3,6,2,1,9,8,3,8,2,1,4,18,7,3,5,2,1,10,4,6,6,3,6,2,1,5,9,4,4,4,3,3,2,1,1,1,2,1,4,2,1,3,8,2,1,5,3,6,2,1,12,8,3,8,2,1,4,8,7,3};
vl ansr={-1,1,2,2,4,3,3,4,8,4,4,6,5,7,5,5,13,9,6,11,6,6,7,22,9,7,8,7,7,17,8,10,11,8,12,8,8,11,17,9,10,11,9,10,9,9,10,11,12,12,14,13,13,14,18,14,14,16,15,17,15,15,25,19,16,20,16,16,17,22,19,17};
while(t--) {
ll n; cin>>n;
if(n>=72) {
ll B=888888888888888880ll;
ll p=n/9,q=n%9;
ll lef=B+q;
ll dif=(n-8*(9-q))/9;
ll rig=B+8+dif;
cout<<lef<<" "<<rig<<nl;
}
else {
cout<<ansl[n]<<" "<<ansr[n]<<nl;
}
}
}