結果
問題 | No.2921 Seated in Classroom |
ユーザー | jastaway【競プロ】@青復帰!!! |
提出日時 | 2024-10-12 15:06:13 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 283 ms / 2,000 ms |
コード長 | 6,769 bytes |
コンパイル時間 | 4,916 ms |
コンパイル使用メモリ | 310,512 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 15:06:21 |
合計ジャッジ時間 | 6,980 ms |
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 251 ms
5,248 KB |
testcase_01 | AC | 132 ms
5,248 KB |
testcase_02 | AC | 102 ms
5,248 KB |
testcase_03 | AC | 253 ms
5,248 KB |
testcase_04 | AC | 283 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; // #include <boost/rational.hpp> // using namespace boost; // using rat = rational<long long int>; #define ll long long #define ld long double #define ull uint64_t #define pll pair<ll,ll> #define vll vector<ll> #define vvll vector<vll> #define vvvll vector<vvll> #define vpll vector<pll> #define v(T) vector<T> #define vv(T) vector<vector<T>> #define vvv(T) vector<vector<vector<T>>> using mint = modint998244353; template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>; #define maxseg(T) segtree<T, [](T x, T y){return max(x, y);}, [](){return (T)(-(1LL << 60));}> #define minseg(T) segtree<T, [](T x, T y){return min(x, y);}, [](){return (T)((1LL << 60));}> #define sumseg(T) segtree<T, [](T x, T y){return x + y;}, [](){return (T)(0);}> // template<class T> using maxseg = segtree<T, [](T x, T y){return max(x, y);}, [](){return (T)(-(1 << 30));}>; // template<class T> using minseg = segtree<T, [](T x, T y){return min(x, y);}, [](){return (T)((1 << 30));}>; // template<class T> using sumseg = segtree<T, [](T x, T y){return x + y;}, [](){return (T)(0);}>; // template<class T> struct v : vector<T> { using vector<T> :: vector; }; // template<class T> struct vv : vector<v<T>> { using vector<v<T>> :: vector; }; // template<class T> struct vvv : vector<vv<T>> { using vector<vv<T>> :: vector; }; template<class T> inline bool chmin(T& a, T b) {if(a > b){a = b; return true;} else {return false;}}; template<class T> inline bool chmax(T& a, T b) {if(a < b){a = b; return true;} else {return false;}}; #define rep(i,n) for(ll i = 0; i < (ll)(n); i++) #define repr(i,n) for(ll i = (ll)(n) - 1; i >= 0; i--) #define REP(i, l, r) for(ll i = (ll)l; i <= (ll)(r); i++) #define REPR(i, l, r) for(ll i = (ll)r; i >= (ll)(l); i--) const ll inf = (1 << 30); const ll INF = ((ll)1 << 60); const vector<pair<ll, ll>> DIJ = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; template<class T> void out(T a){cout << a << endl;} void out1(mint a){cout << a.val();} template<class T> void out1(T a){cout << a;} template<class T, class U> void out2(T a, U b){cout << a << " " << b << endl;} template<class T, class U, class V> void out3(T a, U b, V c) {cout << a << " " << b << " " << c << endl;} template<class T, class U> void outp(pair<T, U> a){ out1(a.first); out1(" "); out1(a.second); cout << endl; } template<class T> void outv(T a){rep(i, a.size()){ cout << a.at(i) << " "; } cout << endl;} template<class T> void outvmint(T a) {rep(i, a.size()) { cout << a.at(i).val() << " "; } cout << endl;} template<class T> void outvL(T a){rep(i, a.size()){out(a.at(i));}} template<class T> void outvLmint(T a) {rep(i, a.size()){out(a.at(i).val());}} template<class T> void outvv(T a){rep(i, a.size()){ rep(j, a.at(i).size()){cout << a.at(i).at(j) << " "; } cout << endl; }} template<class T> void outvp(T a){rep(i, a.size()){ out2(a.at(i).first, a.at(i).second); }} void setpre(int a){cout << fixed << setprecision(a);} #define outN out("No") #define outY out("Yes") #define outL cout << endl #define dame(a) {out(a);return 0;} #define All(a) (a).begin(), (a).end() template<class T> inline void sortr(T& v){sort(All(v)); reverse(All(v));} template<class T> inline vector<int> argsort(T V, bool rev = false){vector<int> res(V.size()); iota(res.begin(), res.end(), 0); sort(res.begin(), res.end(), [&](int x, int y){if(!rev){return V.at(x) < V.at(y);}else{return V.at(x) > V.at(y);}}); return res;} template<class T> inline void sort_by_idx(T& V, vector<int>& I){assert(V.size() == I.size()); T tmpv = V; for(int loopi = 0; loopi < (int)I.size(); loopi++){V.at(loopi) = tmpv.at(I.at(loopi));}} template<class T, class U> inline void sortp(vector<T>& v1, vector<U>& v2, bool rev1 = false, int rev2 = false){assert(v1.size() == v2.size()); vector<int> I(v1.size()); iota(I.begin(), I.end(), 0); sort(I.begin(), I.end(), [&](const int x, const int y){if(v1.at(x) != v1.at(y)){return (bool)(rev1 ^ (v1.at(x) < v1.at(y)));}else{if(v2.at(x)==v2.at(y)){return false;} return (bool)(rev2 ^ (v2.at(x) < v2.at(y)));}}); sort_by_idx(v1, I); sort_by_idx(v2, I);} template<class T> T POW(T x, ll n) {T ret = 1; while(n > 0){if(n & 1) ret *= x; x *= x; n >>= 1;} return ret;} ll powll(ll x, ll n){ll ret = 1; while(n > 0){if(n & 1) ret *= x; x *= x; n >>= 1;} return ret;} #define cin1(n) cin >> (n) #define cin2(n, m) cin >> (n) >> (m) #define cin3(n, m, k) cin >> (n) >> (m) >> (k) #define cin4(n, m, k, l) cin >> (n) >> (m) >> (k) >> (l) #define cinv(a) rep(lopi, a.size()) cin >> (a).at(lopi) #define cinll1(n) ll n; cin >> (n) #define cinll2(n, m) ll n, m; cin >> (n) >> (m) #define cinll3(n, m, k) ll n, m, k; cin >> (n) >> (m) >> (k) #define cinll4(n, m, k, l) ll n, m, k, l; cin >> (n) >> (m) >> (k) >> (l) #define cinvll(a, n) vll a(n); rep(lopi, (n)) cin >> (a).at(lopi) #define cinstr(S) string S; cin >> (S) #define cinvt(type, a, n) v(type) a(n); rep(lopi, n) cin >> (a).at(lopi) #define makeundirGll(G, N, M) G = vvll(N); rep(lopi, M) {ll a, b; cin >> a >> b; G.at(a-1).push_back(b-1); G.at(b-1).push_back(a-1);} #define makedirGll(G, N, M) G = vvll(N); rep(lopi, M) {ll a, b; cin >> a >> b; G.at(a-1).push_back(b-1);} #define makeundirwghGll(G, N, M) G = vv(pll)(N); rep(lopi, M) {ll a, b, c; cin >> a >> b >> c; G.at(a-1).push_back({b-1,c}); G.at(b-1).push_back({a-1, c});} #define makedirwghGll (G, N, M) G = vv(pll)(N); rep(lopi, M) {ll a, b, c; cin >> a >> b >> c; G.at(a-1).push_back({b-1, c});} ll llceil(ll x, ll y) { if(x >= 0) {return(x / y + (ll)(x % y != 0)); } else { return -((-x) / y); } } inline bool inLR(ll x, ll L, ll R){ return (L <= x && x < R); } inline bool is_in_Rect(ll pos_x, ll pos_y, ll rect_H, ll rect_W, ll rect_h = 0, ll rect_w = 0){ return (rect_h <= pos_x && pos_x < rect_H && rect_w <= pos_y && pos_y < rect_W); } template<class T> vector<T> &operator++(vector<T> &v) {for(auto &e : v){e++;} return v;} template<class T> vector<T> operator++(vector<T> &v, signed) {auto res=v; for(auto &e : v){e++;} return res;} template<class T> vector<T> &operator--(vector<T> &v) {for(auto &e : v){e--;} return v;} template<class T> vector<T> operator--(vector<T> &v, signed) {auto res=v; for(auto &e : v){e--;} return res;} template<class T, class U> pair<T, U> operator+(pair<T, U> &x, pair<T, U> &y) { return make_pair(x.first + y.first, x.second + y.second); } template<class T, class U> void operator+=(pair<T, U> &x, pair<T, U> &y) { x = x + y; } int main() { std::cin.tie(nullptr), std::ios_base::sync_with_stdio(false); cinll1(T); while(T--) { cinll2(N, M); ll mx1 = llceil(N, 4); ll seet = mx1 * 8 - N; if(seet >= M) out(mx1); else { out(llceil(M - seet, 8) + mx1); } } }