結果
| 問題 | No.3448 ABBBBBBBBC |
| コンテスト | |
| ユーザー |
ababsadfff
|
| 提出日時 | 2026-03-01 19:45:20 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 2,000 ms |
| コード長 | 1,715 bytes |
| 記録 | |
| コンパイル時間 | 3,431 ms |
| コンパイル使用メモリ | 337,172 KB |
| 実行使用メモリ | 7,968 KB |
| 最終ジャッジ日時 | 2026-03-01 19:45:40 |
| 合計ジャッジ時間 | 4,373 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/unique_ptr.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/memory:80,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:58,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'void solve()' at main.cpp:79:48:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'end' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'void solve()':
main.cpp:19:12: note: 'end' was declared here
19 | ll n,m,end;
| ^~~
ソースコード
#include<bits/stdc++.h>
#define ll long long
#define vi vector<ll>
using namespace std;
void s_si(auto &arr)
{
//return;
cout <<endl<< "________________" <<endl;
for (auto i : arr)
{
cout << i <<" ";
}
cout <<endl<< "________________"<<endl;
}
vi nxt(100,0);
void solve()
{
ll n,m,end;
cin >> n >>m;
ll now=1;
ll i;
for(i=10;i!=98;i=nxt[i])
{
if(m>=now&&m<now+n*8)
{
break;
}
now+=n*8;
}
ll tail=i%10,head=i/10;
ll cnt1=0;
for(int x=0;x<tail;x++)
{
if(x!=head)
{
cnt1++;
}
}
ll cnt2=8-cnt1;
ll num,tar;
if(now+cnt1*n>m)
{
num=(m-now)/cnt1+1;
tar=(m-now)%cnt1+1;
for(int i=0;i<tail;i++)
{
if(i==head)
{
continue;
}
tar--;
if(tar==0)
{
end=i;
break;
}
}
}
else
{
num=n-(m-(now+cnt1*n))/cnt2;
tar=(m-(now+cnt1*n))%cnt2+1;
for(int i=tail+1;i<=9;i++)
{
if(i==head)
{
continue;
}
tar--;
if(tar==0)
{
end=i;
break;
}
}
}
cout << num+2<<" "<<head<<" "<< tail<<" "<<end <<"\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for(int i=10;i<=97;i++)
{
if(i%11==0) continue;
nxt[i]=((i+1)%11!=0)?i+1:i+2;
}
//s_si(nxt);
ll t;
cin >> t;
while (t--)
{
solve();
/* code */
}
}
ababsadfff