1 条题解

  • 0
    @ 2025-7-12 14:25:23

    O(1)O(1)

    只有有 00 所在的行列会产生贡献,即只有一行一列产生贡献。

    考虑 11 填入的位置

    1. 如果 1100 在同一00 这一无论填什么贡献都为 11 .
    2. 如果 1100 在同一00 这一无论填什么贡献都为 11 .

    所以选择行列更大的那一方填入,另一方贡献为 11 . 答案为max(n,m)+1max(n,m) + 1

    #include<bits/stdc++.h>
    
    using namespace std;
    
    typedef long long LL;
    typedef pair<LL, LL> PII;
    
    #define x first
    #define y second
    
    const int N = 2e5 + 10, mod = 1e9;
    
    
    int main()
    {
        int n, m;
        cin >> n >> m;
        cout << max(n, m) + 1 << endl;
        
    }
    
    • 1

    信息

    ID
    120
    时间
    1000ms
    内存
    256MiB
    难度
    2
    标签
    递交数
    18
    已通过
    10
    上传者