QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#909149 | #10022. Jumping Game | cmk666 | AC ✓ | 8ms | 11776kb | C++23 | 10.3kb | 2025-02-21 16:27:34 | 2025-02-21 16:27:34 |
Judging History
answer
/* _ _ _ _ __ __ __
/ \ _ _ | |_ | |__ ___ _ __ _ ___ _ __ ___ | | __ / /_ / /_ / /_
/ _ \ | | | | | __| | '_ \ / _ \ | '__| (_) / __| | '_ ` _ \ | |/ / | '_ \ | '_ \ | '_ \
/ ___ \ | |_| | | |_ | | | | | (_) | | | _ | (__ | | | | | | | < | (_) | | (_) | | (_) |
/_/ \_\ \__,_| \__| |_| |_| \___/ |_| (_) \___| |_| |_| |_| |_|\_\ \___/ \___/ \___/
[Created Time: 2025-02-21 16:14:36]
[Last Modified Time: 2025-02-21 16:27:16] */
#ifdef LOCAL
#include<bits/stdc++.h>
#include"debug.h"
#else
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
inline void _chk_i() {}
inline char _gc_nochk() { return getchar(); }
inline char _gc() { return getchar(); }
inline void _chk_o() {}
inline void _pc_nochk(char c) { putchar(c); }
inline void _pc(char c) { putchar(c); }
template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
inline void _chk_i() {}
inline char _gc_nochk() { return *_read_ptr++; }
inline char _gc() { return *_read_ptr++; }
#endif
inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
inline void _pc_nochk(char c) { *_write_ptr++ = c; }
inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
template <> inline constexpr bool _is_signed < __int128 > = true;
template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
inline bool _isgraph(char c) { return c >= 33; }
inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
constexpr struct _table {
#ifndef LOCAL
int i[65536];
#endif
char o[40000]; constexpr _table() :
#ifndef LOCAL
i{},
#endif
o{} {
#ifndef LOCAL
for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
template < class T > inline constexpr T _pw10 < T, 0 > = 1;
inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
template < class T, bool neg >
#ifndef LOCAL
__attribute__((no_sanitize("undefined")))
#endif
inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
inline void write(bool x) { _pc(x | 48); }
inline void write(char c) { _pc(c); }
inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
inline void write(const string &s) { for ( char c : s ) _pc(c); }
template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
template < class T > inline void print(const T &x) { write(x); }
inline void print_cstr(const char *x) { write_cstr(x); }
template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
inline void println() { _pc(10); }
inline void println_cstr() { _pc(10); }
template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
} using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
int n, m, x, y;
inline void work()
{
read(n, m, x, y);
if ( n > m ) swap(n, m), swap(x, y);
if ( n == 1 ) { println("Brahma"s); return; }
if ( n == 2 && ( m & 3 ) == 1 && ( y & 3 ) == 1 ) { println("Brahma"s); return; }
if ( n == 2 && ( m & 3 ) == 2 && ( y & 3 ) == 1 ) { println("Brahma"s); return; }
if ( n == 2 && ( m & 3 ) == 2 && ( y & 3 ) == 2 ) { println("Brahma"s); return; }
if ( n == 2 && ( m & 3 ) == 3 && ( y & 3 ) == 2 ) { println("Brahma"s); return; }
if ( n == 3 && m == 3 && x & 1 && y & 1 ) { println("Annapurna"s); return; }
if ( n == 3 && m == 5 && x & 1 && y == 3 ) { println("Annapurna"s); return; }
if ( n & 1 && m & 1 && ~( x + y ) & 1 ) { println("Brahma"s); return; }
println("Annapurna"s);
}
int main() { int t; read(t); For(tt, 1, t) work(); return 0; }
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 6 6 6 6 7 19 7 3
output:
Annapurna Brahma
result:
ok 2 tokens
Test #2:
score: 0
Accepted
time: 8ms
memory: 8576kb
input:
200000 652695136 300894239 597885661 210561036 360959967 978016924 93079366 526744440 466252780 624092439 424175327 115453901 16 16 10 10 14 19 12 2 281314939 780709721 243391639 329443634 22 15 9 3 17 19 5 10 19 25 17 1 715105073 886209327 453295637 441337663 18 23 5 2 7 21 3 20 25 23 7 1 21 23 10 ...
output:
Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Brahma Annapurna Annapurna Brahma Brahma Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Brahma Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna A...
result:
ok 200000 tokens
Test #3:
score: 0
Accepted
time: 7ms
memory: 11648kb
input:
200000 526683996 507683839 192087359 134209365 777201493 690131003 151764115 606527637 675701905 674619824 58536700 122558085 700454273 882785687 122989900 387146324 600481551 834366600 43884418 469732945 764675047 703187566 727086690 138518381 876010728 663066274 294959036 465626012 506072517 98205...
output:
Annapurna Brahma Annapurna Brahma Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Brahma Annapurn...
result:
ok 200000 tokens
Test #4:
score: 0
Accepted
time: 5ms
memory: 11648kb
input:
200000 617492934 823112368 221654695 685667625 593351835 541316124 89655917 368032969 592719874 542517035 347260589 306137282 911399738 631962154 909555981 403355222 896896265 665350262 740459526 152542784 930533048 891462285 405098913 136601764 641128770 545630337 263530538 479641332 577372278 6711...
output:
Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapu...
result:
ok 200000 tokens
Test #5:
score: 0
Accepted
time: 7ms
memory: 11776kb
input:
200000 739371388 812282058 205759703 111734544 860969912 797905883 753790878 451957125 994256746 599356207 317152954 270737724 672312029 967998621 622669245 200224505 844133935 595693574 702400554 516569646 836080076 993436865 251285038 439241730 953801861 825622688 906857917 415045163 514805268 969...
output:
Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Brahma Annapurna Annap...
result:
ok 200000 tokens
Test #6:
score: 0
Accepted
time: 8ms
memory: 11520kb
input:
200000 531202709 637693289 451430745 22844146 930136346 976293392 20569707 302860895 815575859 554541271 367392775 527340476 982580675 892695791 445805682 874182106 721974403 575315981 209043614 424182748 930290793 805214171 182573386 164199783 539005740 978994195 169914298 295632474 593523554 80663...
output:
Annapurna Annapurna Annapurna Brahma Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Brahma Annapurna Brahma Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna Annapurna An...
result:
ok 200000 tokens