版本比较
火车头
正文
增加 252 行删除 0 行
123487 行未改动92939495```cpp line-numbers#pragma GCC optimize(3)#pragma GCC target("avx")#pragma GCC optimize("Ofast")87 行未改动#define cin FastIO::FastIO()#define cout FastIO::FastIO()#define endl '\n'```1234567887 行未改动96979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347兄弟们见过火车头吧,但一定没见过如此长的。~~浪费你们五分钟时间~~。```cpp line-numbers#pragma GCC optimize(3)#pragma GCC target("avx")#pragma GCC optimize("Ofast")87 行未改动#define cin FastIO::FastIO()#define cout FastIO::FastIO()#define endl '\n'```这是第一个,以下是第二个。```cpp line-numbers#include <cstdint>#include <cstdio>#include <string>namespace oi {constexpr std::size_t IOBUFFER = 32 * 1024 + 1;constexpr char endl = '\n';[[gnu::always_inline]] inline bool isspace(unsigned char v) {static constexpr bool map[256] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,};return map[v];}class fastio {private:std::uint8_t __input_buffer[IOBUFFER];std::size_t __input_buffer_usage = 0, __input_buffer_point = 0;std::uint8_t __output_buffer[IOBUFFER];std::size_t __output_buffer_point = 0;std::FILE *__input = nullptr;std::FILE *__output = nullptr;static constexpr std::uint8_t __number_base = 10;[[gnu::always_inline]] inline std::int16_t get_char() {if (this->__input_buffer_point >= this->__input_buffer_usage) [[unlikely]] {this->__input_buffer_usage =std::fread(this->__input_buffer, sizeof(this->__input_buffer[0]),sizeof(this->__input_buffer), this->__input);this->__input_buffer_point = 0;}if (this->__input_buffer_point >= this->__input_buffer_usage) [[unlikely]] {return -1;}std::uint8_t res = this->__input_buffer[this->__input_buffer_point];this->__input_buffer_point++;return res;}[[gnu::always_inline]] inline std::int16_t fetch_char() {if (this->__input_buffer_point >= this->__input_buffer_usage) [[unlikely]] {this->__input_buffer_usage =std::fread(this->__input_buffer, sizeof(this->__input_buffer[0]),sizeof(this->__input_buffer), this->__input);this->__input_buffer_point = 0;}if (this->__input_buffer_point >= this->__input_buffer_usage) [[unlikely]] {return -1;}std::uint8_t res = this->__input_buffer[this->__input_buffer_point];return res;}public:[[gnu::always_inline]] inline void flush() {std::fwrite(this->__output_buffer, sizeof(this->__output_buffer[0]),this->__output_buffer_point, this->__output);this->__output_buffer_point = 0;}private:[[gnu::always_inline]] inline void put_char(std::uint8_t v) {if (this->__output_buffer_point == sizeof(this->__output_buffer)) {this->flush();}this->__output_buffer[this->__output_buffer_point] = v;this->__output_buffer_point++;}[[gnu::always_inline]] inline std::uint8_t __char_cast(std::uint8_t v) const {if (v <= 9)return '0' + v;elsereturn 'a' + (v - 10);}[[gnu::always_inline]] inline void __skip_empty() {while (true) {std::uint8_t ch = this->fetch_char();if (!oi::isspace(static_cast<unsigned char>(ch))) {return;}this->__input_buffer_point++;}}public:fastio(const char *in, const char *out) {__input = std::fopen(in, "r");__output = std::fopen(out, "w");}fastio(std::FILE *in, std::FILE *out) {__input = in;__output = out;}fastio() : fastio(stdin, stdout) {}fastio(const fastio &) = delete;fastio &operator=(const fastio &) = delete;~fastio() { this->flush(); }fastio &operator<<(unsigned long long p) {std::uint8_t tmp[70], cnt = 0;do {tmp[cnt] = this->__char_cast(p % this->__number_base);cnt++;p /= this->__number_base;} while (p != 0);for (int i = cnt - 1; i >= 0; --i)this->put_char(tmp[i]);return *this;}fastio &operator<<(long long p) {if (p < 0) {put_char('-');return this->operator<<(static_cast<unsigned long long>(-(p + 1)) + 1ULL);} else {return this->operator<<(static_cast<unsigned long long>(p));}}fastio &operator<<(short p) { return this->operator<<(static_cast<long long>(p)); }fastio &operator<<(int p) { return this->operator<<(static_cast<long long>(p)); }fastio &operator<<(long p) { return this->operator<<(static_cast<long long>(p)); }fastio &operator<<(unsigned short p) {return this->operator<<(static_cast<unsigned long long>(p));}fastio &operator<<(unsigned int p) {return this->operator<<(static_cast<unsigned long long>(p));}fastio &operator<<(unsigned long p) {return this->operator<<(static_cast<unsigned long long>(p));}fastio &operator<<(char p) {this->put_char(p);return *this;}fastio &operator<<(const char *p) {if (!p)return *this;while (*p) {this->put_char(*p);p++;}return *this;}fastio &operator<<(const std::string &p) { return this->operator<<(p.c_str()); }fastio &operator<<(std::nullptr_t) { return *this; }fastio &operator>>(unsigned long long &p) {p = 0;this->__skip_empty();while (true) {std::uint8_t ch = this->get_char();if (oi::isspace(static_cast<unsigned char>(ch)))return *this;p *= 10;p += (ch - '0');}}fastio &operator>>(long long &p) {bool neg = false;p = 0;this->__skip_empty();std::uint8_t ch = this->get_char();if (ch == '-') {neg = true;ch = this->get_char();}while (true) {if (oi::isspace(static_cast<unsigned char>(ch))) {if (neg)p = -p;return *this;}p *= 10;p += (ch - '0');ch = this->get_char();}}fastio &operator>>(char &c) {c = this->get_char();return *this;}fastio &operator>>(char *c) {this->__skip_empty();for (int i = 0;; i++) {std::int16_t ch = this->get_char();if (ch == -1 || oi::isspace(static_cast<unsigned char>(ch))) {c[i] = '\0';return *this;}c[i] = ch;}}fastio &operator>>(short &p) {long long tmp;*this >> tmp;p = tmp;return *this;}fastio &operator>>(int &p) {long long tmp;*this >> tmp;p = tmp;return *this;}fastio &operator>>(long &p) {long long tmp;*this >> tmp;p = tmp;return *this;}fastio &operator>>(unsigned short &p) {unsigned long long tmp;*this >> tmp;p = tmp;return *this;}fastio &operator>>(unsigned int &p) {unsigned long long tmp;*this >> tmp;p = tmp;return *this;}fastio &operator>>(unsigned long &p) {unsigned long long tmp;*this >> tmp;p = tmp;return *this;}};}```火车头由 AI 生成。