A掉紫题祭

· · 个人记录

一、前言

我A掉了紫题(点此查看记录)(点此查看原题)!

硬刚大模拟

共计用10h

如果想看题解,不要看我的(有史以来写的最乱的一次)

还有,这道题不是我A的,是我抄的,抄的理由:想看zhaojinxi的程序头

事实证明,收货很大

//MOD ZHAOJINXI START
#ifndef DEBUG
    #define NDEBUG
#endif
#include <bits/stdc++.h>
#define def(v) int &v = e[i].v
#define cls(a) memset (a, 0, sizeof (a))
#define mset(a, b) memset (a, b, sizeof (a))
#define go(i,e,...) for (int i = __VA_ARGS__; i; i = e[i].nt)
#define fir(i,a,...) for (int i = a, i ## _end = __VA_ARGS__; i <= i ## _end; ++i)
#define firr(i,a,...) for (int i = a, i ## _end = __VA_ARGS__; i >= i ## _end; --i)
#ifdef DEBUG
    #define debug(...) (void)(fprintf (stderr, "debug in %d: ", __LINE__), fprintf (stderr, __VA_ARGS__), fprintf (stderr, "\n"))
    #define dbug(x) (std::cerr << #x " = " << (x) << std::endl)
#else
    #define debug(...)
    #define dbug(...)
#endif
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#ifndef DEBUG
    namespace IO {
        char ibuf[1 << 21], *p1 = ibuf, *p2 = ibuf, obuf[1 << 21], *p = obuf;
        #define getchar() (::IO::p1 == ::IO::p2 && (::IO::p2 = (::IO::p1 = ::IO::ibuf) + fread (::IO::ibuf, 1, 1 << 21, stdin), ::IO::p1 == ::IO::p2) ? EOF : *::IO::p1++)
        #define putchar(x) (::IO::p == ::IO::obuf + sizeof (::IO::obuf) && (fwrite (::IO::obuf, 1, 1 << 21, stdout), ::IO::p = ::IO::obuf), *::IO::p++ = x)
        #define ioflush() (void)(fwrite (::IO::obuf, 1, ::IO::p - ::IO::obuf, stdout), fflush (stdout), ::IO::p = ::IO::obuf)
        struct outflush {~outflush () {ioflush ();}} flushout;
    }
#endif
int rec () {
    int ch;
    while (isspace (ch = getchar ()));
    return ch;
}
bool rei (char& c) {
    int ch;
    while (isspace (ch = getchar ()));
    if (ch == EOF) return false;
    c = ch;
    return true;
}
bool rei (char* s) {
    if (!rei (*s)) return false;
    int ch;
    while (*++s = ch = getchar (), ch != EOF && !isspace (ch));
    *s = 0;
    return true;
}
template<class T>
bool rei (T& x) {
    bool f = true;
    int ch;
    for (ch = getchar (); !isdigit (ch); ch = getchar ()) {
        if (ch == EOF) return false;
        f = ch != '-';
    }
    x = 0;
    if (f) do x = x * 10 + (ch & 15); while (isdigit (ch = getchar ()));
    else do x = x * 10 - (ch & 15); while (isdigit (ch = getchar ()));
    return true;
}
void pti (const char& c) {putchar (c);}
void pti (const char* s) {while (*s) putchar (*s++);}
template<class T>
void pti (T x) {
    char buf[sizeof (T) * 3], *p = buf + 1;
    if (x >= 0) *buf = (x % 10) | 48, x /= 10;
    else putchar ('-'), *buf = (-(x % 10)) | 48, x = -(x / 10);
    while (x) *p++ = (x % 10) | 48, x /= 10;
    while (p != buf) putchar (*--p);
}
template<class T> void pri (const T& x) {pti (x), putchar (' ');}
template<class T> void prn (const T& x) {pti (x), putchar ('\n');}
template<class T, class... Args> bool rei (T&& x, Args&&... args) {return rei (std::forward<T> (x)) ? rei (args...) : false;}
template<class T, class... Args> void pti (const T& x, const Args&... args) {pti (x), pti (args...);}
template<class T, class... Args> void pri (const T& x, const Args&... args) {pri (x), pri (args...);}
template<class T, class... Args> void prn (const T& x, const Args&... args) {pri (x), prn (args...);}
template<class T1, class T2> T1& cmax (T1& a, const T2& b) {return a < b ? a = b : a;}
template<class T1, class T2> T1& cmin (T1& a, const T2& b) {return a > b ? a = b : a;}
template<class T> T lowbit (const T& x) {return x & -x;}
using namespace std;
//MOD ZHAOJINXI END

这个DEBUG对我调试起了很大帮助

再次MOD ZHAOJINXI!

二、回忆

还记得,初一时,这样的一段对话:

#define ycy 要淳译

(asd宣传OI(汉诺塔那部分我记忆尤新)后)

我:ycy,写一个程序,输入两个数,输出它们的和,需要几行?

ycy:大概6行

我:那写一个程序,使它输入一段代码,输出运行结果,需要几行?

ycy:(这TM什么鬼问题)1000行?

就此,我被埋下了写编译器的种子

如今,我完成了CYaRon!语言的编译器,也算实现了梦想的一部分吧!