結果
問題 |
No.2921 Seated in Classroom
|
ユーザー |
|
提出日時 | 2024-10-12 16:57:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 686 bytes |
コンパイル時間 | 2,774 ms |
コンパイル使用メモリ | 243,240 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 16:58:36 |
合計ジャッジ時間 | 5,346 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 5 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n,k); for(ll i = k; i < (int)(n); i++) #define rep1(i, n) for(ll i = 0; i < (n); ++i) using ll = long long; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } int main() { ll t; cin>>t; rep(i,t,0){ ll n,m; cin>>n>>m; ll n1=n/4,m1=m/4,m2=m%4,n2=n%4; if(n>m){ if(n2!=0){ cout<<n1+1<<endl; }else{ cout<<n1<<endl; } }else{ n-=4*n1; m-=4*m1; ll ans1=(m-n)/8,ans2=(m-n)%8; if(ans2!=0){ cout<<n1+ans1+1<<endl; }else{ cout<<n1+ans1<<endl; } } } }