跳到正文

GZRyan2014_CR400AF

1424748

各位旅客,广铁U彩提示您,前方到站是:广州南站。欢迎大家来广州!本人为OIer&广局车迷&历史迷(明粉),请互关谢谢喵

在洛谷打开
资料、奖项与版本

个人简介是不是也要头图啊……

0x00 …

2026马年快乐!!!

十年OI一场空,不开long long见祖宗!

骗分过样例,暴力出奇迹。

数学先打表,DP 看运气。

穷举 TLE,模拟 MLE,贪心还 CE。

老骥伏枥,志在千里。

广州地铁,全程为你。

垂死病中惊坐起,抢铁U彩提示你。

0x01 语文区

将进酒

君不见黄河之水天上来,奔流到海不复回。

君不见高堂明镜悲白发,朝如青丝暮成雪。

人生得意须尽欢,莫使金樽空对月。

天生我材必有用,千金散尽还复来。

烹羊宰牛且为乐,会须一饮三百杯。

岑夫子,丹丘生,将进酒,杯莫停。

与君歌一曲,请君为我倾耳听。

钟鼓馔玉不足贵,但愿长醉不复醒。

古来圣贤皆寂寞,惟有饮者留其名。

陈王昔时宴平乐,斗酒十千恣欢谑。

主人何为言少钱,径须沽取对君酌。

五花马、千金裘,呼儿将出换美酒,与尔同销万古愁。


西江月・证明

即得易见平凡,仿照上例显然。

留作习题答案略,读者自证不难。

反之亦然同理,推论自然成立。

略去过程Q.E.D.,由上可知证毕。

0x02 公式区

emmm…无聊放点公式

eiπ⋅π9992026+22992⋅∑n=0∞(4n)!(26390n+1103)(n!)43964n+∑i=0i<=2026i+(20268882026666)3∗hash("2026发大财")+2026666888999ull=2026马年大吉//乱写的……e^{i \pi} \cdot \frac{\pi^{999}}{2026} + \frac{2\sqrt{2}}{99^2} \cdot \sum_{n=0}^{\infty}\frac{(4n)!(26390n+1103)}{(n!)^4 396^{4n}} + \sum_{i=0}^{i<=2026}i+(\frac{2026^{888}}{2026^{666}})^3 * {hash("2026发大财")}+2026666888999ull=\text{2026马年大吉} \qquad \color{#22AB22} \text{//乱写的……}
{(常数)′=0(x)′=1(xn)′=nxn−1(logba)′=1aln⁡b\begin{cases} (\text{常数})'=0 \\ (x)'=1 \\ (x^n)'=nx^{n-1} \\ (log_b a)'=\frac{1}{a \ln b} \\ \end{cases} eiθ=cos⁡θ+isin⁡θe^{i \theta} = \cos \theta + i \sin \theta eiπ+1=0e^{i \pi} + 1 = 0

一元二次方程求根公式:

x1,2=−b±b2−4ac2a\large x_{1,2}=\frac{-b \pm \sqrt{b^2-4ac}}{2a}

Δ=b2−4ac\Delta = b^2-4ac


一元三次方程求根公式:

p=3ac−b23a2,q=2b3−9abc+27a2d27a3,ω=e2πi/3=−12+32i\large p=\frac{3ac-b^2}{3a^2}, q=\frac{2b^3-9abc+27a^2d}{27a^3}, \omega=e^{2 \pi i/3}=-\frac{1}{2}+\frac{\sqrt{3}}{2}i

{x1=[−q2+(q2)2+(p3)33+−q2−(q2)2+(p3)33]−b3ax2=[ω⋅−q2+(q2)2+(p3)33+ω2⋅−q2−(q2)2+(p3)33]−b3ax3=[ω2⋅−q2+(q2)2+(p3)33+ω⋅−q2−(q2)2+(p3)33]−b3a\begin{cases} \large x_1=[\sqrt[3]{-\frac{q}{2}+\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}+\sqrt[3]{-\frac{q}{2}-\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}]-\frac{b}{3a} \\ \large x_2=[\omega \cdot \sqrt[3]{-\frac{q}{2}+\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}+\omega^2 \cdot \sqrt[3]{-\frac{q}{2}-\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}]-\frac{b}{3a} \\ \large x_3=[\omega^2 \cdot \sqrt[3]{-\frac{q}{2}+\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}+\omega \cdot \sqrt[3]{-\frac{q}{2}-\sqrt{(\frac{q}{2})^2+(\frac{p}{3})^3}}]-\frac{b}{3a} \end{cases}

Δ=(q2)2+(p3)3\Delta = (\frac{q}{2})^2+(\frac{p}{3})^3


4⋅∫0+∞e−ss5ds2+∫−∞+∞e−t22dt∫0+∞sint2dt(∑n=0∞(−1)n2n+1∫0+∞sinxxdx+∑n=1∞arctan2n2limt→0+∫−20202020tcosxx2+t2dx)limn→+∞[(∫01xn−11+xdx)n−12]n2−54=2026\large 4 \cdot \frac{\frac{\int_0^{+ \infty} e^{-s}s^5 ds}{2}+\frac{\int_{- \infty}^{+ \infty} e^{- \frac{t^2}{2}} dt}{\int_0^{+ \infty} sin t^2 dt}(\frac{\sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}}{\int_0^{+ \infty} \frac{sin x}{x} dx}+ \frac{\sum_{n=1}^ \infty arctan \frac{2}{n^2}}{lim_{t \to 0}+\int_{-2020}^{2020} \frac{t cos x}{x^2+t^2} dx})}{lim_{n \to + \infty} {[(\int_0^1 \frac{x^{n-1}}{1+x} dx)n- \frac{1}{2}] \frac{n}{2}}} -54=2026

0x03 “正确”(?)的记录全拼

AC=Answer Course=粗略的答案

WA=Wonderful Answer=完美的答案

RE=Run Excellently=完美运行

TLE=Time Limit Enough=时间充裕

MLE=Memory Limit Enough=空间充裕

OLE=Ouput Limit Enough=输出空间充裕

SE=System Excellent=系统良好

CE=Compile Excellently=编译完美

UKE=Unknown Excellent=未知的优秀

AK=Answer Klutzy=粗略的回答


C++
#include <iostream>
#include<iomanip>
#include<vector>
using namespace std;

const double DECAY = 0.81;          // AtCoder 权重衰减系数
const double ELO_DIV = 400.0;       // Elo 公式中的分母

// 全局防优化变量
volatile long long g_sink;

// ------------------------------------------------------------
// 根据排名和全场 Rating 分布,二分求解 Performance
// ------------------------------------------------------------
double calcPerformance(int rank, const vector<double>& ratings) {
    double lo = -8000.0, hi = 8000.0;
    double target = rank - 0.5;
    
    for (int it = 0; it < 100; ++it) {
        double mid = (lo + hi) * 0.5;
        double sum = 0.0;
        for (double r : ratings) {
            sum += 1.0 / (1.0 + pow(10.0, (mid - r) / ELO_DIV));
        }
        if (sum > target)
            lo = mid;
        else
            hi = mid;
    }
    return (lo + hi) * 0.5;
}

// ------------------------------------------------------------
// 根据历史 Performance 计算新 Rating
// perfs[0] = 第一场(最旧),perfs.back() = 最新一场
// ------------------------------------------------------------
double calcRating(const vector<double>& perfs) {
    int n = perfs.size();
    double num = 0.0, den = 0.0;
    for (int i = 0; i < n; ++i) {
        double w = pow(DECAY, n - 1 - i);
        num += perfs[i] * w;
        den += w;
    }
    return num / den;
}

// ------------------------------------------------------------
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    // Windows 控制台支持 UTF-8 中文输出
    #ifdef _WIN32
    //    system("chcp 65001 > nul");
    #endif
    
    cout << "=== AtCoder 等级分预估器 ===\n"
         << "基于官方公式:Performance 通过 Elo 计算,Rating = 加权平均 (q=0.81)\n\n";
    
    double curR;
    int pastN;
    cout << "当前等级分: ";
    cin >> curR;
    cout << "已参加过的 rated 比赛场数: ";
    cin >> pastN;
    
    // ---------- 历史 Performance 输入 ----------
    int histMode;
    cout << "\n[历史成绩]\n"
         << "  1: 我不知道历史 Performance(假设全部等于当前等级分)\n"
         << "  2: 我要手动输入历史 Performance(从最旧到最新)\n"
         << "选择: ";
    cin >> histMode;
    
    vector<double> history;
    if (histMode == 2) {
        history.resize(pastN);
        cout << "输入 " << pastN << " 场历史 Performance:\n";
        for (int i = 0; i < pastN; ++i) cin >> history[i];
    } else {
        history.assign(pastN, curR);
    }
    
    // ---------- 计算模式 ----------
    int mode;
    cout << "\n[计算模式]\n"
         << "  1: 直接输入预估的 Performance\n"
         << "  2: 根据排名 + 对手等级分估算\n"
         << "  3: 批量查询(显示排名 1~N 的表格)\n"
         << "选择: ";
    cin >> mode;
    
    if (mode == 1) {
        double perf;
        cout << "预估 Performance: ";
        cin >> perf;
        
        auto h = history;
        h.push_back(perf);
        double newR = calcRating(h);
        
        cout << fixed << setprecision(2);
        cout << "\nPerformance: " << perf
             << "\n新等级分  : " << newR
             << "\n变化值    : " << (newR >= curR ? "+" : "") << (newR - curR) << "\n";
    }
    else if (mode == 2) {
        int n, rank;
        cout << "总参赛人数: ";
        cin >> n;
        cout << "你的排名(从1开始): ";
        cin >> rank;
        
        int oppMode;
        cout << "\n[对手信息]\n"
             << "  1: 输入全部 " << n << " 个等级分(包含你自己,用当前等级分 " << curR << ")\n"
             << "  2: 近似:其他所有人都等于平均等级分\n"
             << "选择: ";
        cin >> oppMode;
        
        vector<double> ratings;
        if (oppMode == 1) {
            ratings.resize(n);
            cout << "输入等级分:\n";
            for (int i = 0; i < n; ++i) cin >> ratings[i];
        } else {
            double avgR;
            cout << "对手平均等级分: ";
            cin >> avgR;
            ratings.assign(n, avgR);
            ratings[0] = curR;
        }
        
        double perf = calcPerformance(rank, ratings);
        auto h = history;
        h.push_back(perf);
        double newR = calcRating(h);
        
        cout << fixed << setprecision(2);
        cout << "\n预估 Performance: " << perf
             << "\n新等级分           : " << newR
             << "\n变化值             : " << (newR >= curR ? "+" : "") << (newR - curR) << "\n";
    }
    else if (mode == 3) {
        int n;
        double avgR;
        cout << "总参赛人数: ";
        cin >> n;
        cout << "对手平均等级分: ";
        cin >> avgR;
        
        vector<double> ratings(n, avgR);
        ratings[0] = curR;
        
        cout << "\n" << string(50, '-') << "\n";
        cout << " 排名 | Performance |  新等级分  |  变化值\n";
        cout << string(50, '-') << "\n";
        
        int showUpTo = min(n, 60);
        for (int rank = 1; rank <= showUpTo; ++rank) {
            double perf = calcPerformance(rank, ratings);
            auto h = history;
            h.push_back(perf);
            double newR = calcRating(h);
            double delta = newR - curR;
            
            cout << right << setw(5) << rank << " | ";
            cout << setw(11) << fixed << setprecision(2) << perf << " | ";
            cout << setw(12) << newR << " | ";
            cout << (delta >= 0 ? "+" : "") << delta << "\n";
        }
        if (n > showUpTo)
            cout << " ... (仅显示前 " << showUpTo << " 名)\n";
    }
    if (curR < 400) {
        cout << "\n[提示] 你当前等级分 < 400。AtCoder 对低于 400 的显示等级分应用了非线性变换,\n"
             << "因此预测值可能与实际显示的等级分略有差异。\n";
    }
    return 0;
}
共 3 篇
  1. 题解

    P2910 [USACO08OPEN] Clear And Present Danger S 题解

    本文介绍了如何使用Floyd-Warshall算法解决一道最短路题目。当节点数n≤100时,可直接采用暴力Floyd算法,通过三重循环枚举中间点k、起点i和终点j,动态规划地更新所有点对的最短路径。算法核心是不断比较当前路径与经过中间点k的路径长度,取更小值。题目要求计算给定路径中各相邻节点的最短路径之和,最终通过累加dis[a[i-1]][a[i]]得到答案。代码实现包含输入处理、Floyd算法核心逻辑及路径结果计算,适用于数据范围较小的场景。

  2. 题解

    P2078 朋友

    该题解使用并查集(Union-Find)算法解决情侣关系判定问题。核心思路是通过路径压缩优化的Find函数和按秩合并的Union函数,实现对元素集合的合并与查找操作。代码中初始化每个元素的父节点为自己,随后处理p次合并操作和q次查询操作。特别注意:输入的x和y需取反以避免负下标导致的运行错误。最终通过统计两个集合(1号元素所在集合与n+1号元素所在集合)的元素数量,输出较小的值作为答案。

    1 赞
  3. 题解

    P1012[NOIP1998]拼数

    该题要求对多个字符串进行排序,使其拼接后的结果最大。正确解法是自定义比较函数,通过比较两个字符串拼接后的顺序(如比较a+b与b+a的大小)来决定排序方式。直接比较字符串长度或字典序会导致错误,例如"321"和"32"的比较需通过拼接成"32132"与"32321"来判断。提供的C++代码实现了这一逻辑,使用sort函数配合自定义cmp函数完成排序,最终输出按此规则排列的所有字符串。需要注意的是,该方法要求字符串数组长度足够(如题目中的101大小),且输出时需连续拼接所有字符串。

    1 赞