結果
問題 |
No.2921 Seated in Classroom
|
ユーザー |
![]() |
提出日時 | 2024-10-13 17:19:12 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 257 ms / 2,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 91,492 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 17:19:17 |
合計ジャッジ時間 | 2,786 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll t; cin>>t; while(t--){ ll n,m; cin>>n>>m; ll need = (n+4-1) / 4; ll can = need * 8 - n; if(can>=m) cout<<need<<endl; else{ m -= can; ll ans = need + (m+8-1)/8; cout<<ans<<endl; } } }