結果

問題 No.2921 Seated in Classroom
ユーザー s ks k
提出日時 2024-10-17 17:32:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 3,602 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 204,272 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-17 17:32:46
合計ジャッジ時間 5,624 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 300 ms
6,816 KB
testcase_01 AC 172 ms
6,820 KB
testcase_02 AC 131 ms
6,816 KB
testcase_03 AC 313 ms
6,820 KB
testcase_04 AC 308 ms
6,816 KB
testcase_05 AC 2 ms
6,820 KB
testcase_06 AC 1 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>//#define _GLIBCXX_DEBUG 
using namespace std;using ll=__int128_t; template<class T> using V = vector<T>; using ld=long double;using Pa=pair<ll,ll>; using Vll=vector<ll>; using VVll=vector<Vll>; using VVVll=vector<VVll>; using Vb=vector<bool>; using VVb=vector<vector<bool>>; using Vs=vector<string>; using VVs=vector<vector<string>>; using Vc=vector<char>; using VVc=vector<vector<char>>; using Vd=vector<long double>; using VVd=vector<vector<long double>>; const ll MOD=1000000007; const ll INF=(ll)1<<60; ll ceil(ll a, ll b){ return (a+b-1)/b; } ll max(ll a, ll b){ if(a>=b) return a; else return b; }ll min(ll a, ll b){ if(a<=b) return a; else return b; } bool bit(ll s, ll j){ if(s&(1<<j)) return true; return false;} ll nizyo(ll x){return (x)*(x);}template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} else{return false;}}template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b; return true;} else{return false;}} istream& operator>>(istream& is, __int128_t & v){ string s; is >> s; v = 0; for(int i=0; i<(int)s.size(); i++){ if (isdigit(s[i])){ v=v*10+s[i]-'0'; } }if(s[0]=='-') { v *= -1;} return is; } std::ostream &operator<<(std::ostream &dest, __int128_t value){ std::ostream::sentry s(dest); if(s){ __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do{ --d; *d="0123456789"[tmp%10]; tmp/=10; } while(tmp != 0); if(value<0){ --d; *d = '-'; } int len = std::end(buffer)-d; if (dest.rdbuf()->sputn(d, len)!=len){ dest.setstate(std::ios_base::badbit); } } else{cout<<0;} return dest; } string to_string(ll a){ string res=""; while(a>0){ ll b=a%10; char c='0'+b; res+=c; a/=10; } reverse(res.begin(),res.end()); return res; }void OIV(){}template<typename T> void OIV(T &a){if(a.empty()){cout<<"\n"; return;} for(ll ii0=0;ii0<(ll)(a).size();ii0++){cout<<a[ii0]; if(ii0==(ll)(a).size()-1){cout<<"\n";} else{cout<<" ";}}}void OIVV(){}template<typename T> void OIVV(T &a){if(a.empty()){cout<<"\n"; return;}for(ll ii0=0;ii0<(ll)(a).size();ii0++){for(ll jj0=0;jj0<(ll)((a)[ii0]).size();jj0++){cout<<(a)[ii0][jj0]; if(jj0==(ll)((a)[ii0]).size()-1){cout<<"\n";}else{cout<<" ";}}}}void oi(){}template<class Head, class... Tail>void oi(Head&& head,Tail&&... tail){if(sizeof...(tail)!=0){cerr<<head<<" ";} else{cerr<<head<<"\n";}oi(move(tail)...);}void OI(){}template<class Head, class... Tail>void OI(Head&& head,Tail&&... tail){if(sizeof...(tail)!=0){cout<<head<<" ";} else{cout<<head<<"\n";}OI(move(tail)...);} void oiv(){}template<typename T> void oiv(T &a){if(a.empty()){cerr<<"\n"; return;} for(ll ii0=0;ii0<(ll)(a).size();ii0++){cerr<<a[ii0]; if(ii0==(ll)(a).size()-1){cerr<<"\n";} else{cerr<<" ";}}} void ois(){}template<typename T> void ois(T &(a)){if((a).empty()){cerr<<"\n"; return;} auto it=(a).begin(); while(it!=a.end()){ cerr<<*it; it++; if(it!=a.end()){cerr<<" ";}else{cerr<<"\n";}}} void oivv(){}template<typename T> void oivv(T &a){if(a.empty()){cerr<<"\n"; return;}for(ll ii0=0;ii0<(ll)(a).size();ii0++){for(ll jj0=0;jj0<(ll)((a)[ii0]).size();jj0++){cerr<<(a)[ii0][jj0]; if(jj0==(ll)((a)[ii0]).size()-1){cerr<<"\n";}else{cerr<<" ";}}}}
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)// printf("%8.10Lf\n",(ans)); 
#define ALL(a) (a).begin(),(a).end()// Vll A(n); FOR(i,0,n) cin>>A[i];


void yaru(){
    ll n,m; cin>>n>>m;
    
    ll r0=(n+3)/4;
    ll r1=(m+3)/4;
    if(r0>r1){
        OI(r0);// 確実にそれだけ必要
        return;
    }
    else{
        ll ans=(n+m+7)/8;
        OI(ans);
    }
    
    return;
}

int main(){
    ll t; cin>>t;
    FOR(i,0,t) yaru();

    return 0;
}
0