题目链接:https://codeforces.com/contest/1136

A:
题解:直接for一遍扫一下最多能阅读到第几章节扣一下就好了

#include <bits/stdc++.h>
#define pa pair<int, int>
#define mp make_pair
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 105 + 5;
struct node {
    int l,r;
}a[N];
int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i].l >> a[i].r;
    }
    int k;
    cin >> k;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(a[i].r < k) {
            ans++;
        }
        else break;
    }
    cout << n - ans;
    return 0;
}

B:

首先必然要遍历所有点至少一次。那么总路径就是min(n1,nk)+n1min(n - 1, n - k) + n - 1, 其次每次都要拿一次硬币,那么就是nn,并且每次还要扔石头nn,然后还有多扔一次所以再加11

#include <bits/stdc++.h>
#define pa pair<int, int>
#define mp make_pair
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 5005 + 5;
int n,k;
int main() {
    cin >> n >> k;
    int step = min(n - 1 + k - 1, n - k + n - 1);
    cout << step + 2 * n + 1;
    return 0;
}

C.

可以发现每次子矩阵的转置,都是每个副对角线上的交换,那么也就是说对于任意副对角线上的元素是可以互相交换。对于任意aija_{ij} 它必然属于第i+ji + j条副对角线 (从22开始)

#include <bits/stdc++.h>
#define pa pair<int, int>
#define mp make_pair
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 505 + 5;
int a[N][N];
int b[N][N];
vector <int> A[N + N], B[N + N];
int n,m;
int main() {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) 
        for(int j = 1; j <= m; j++) cin >> a[i][j], A[i + j].push_back(a[i][j]);
    for(int i = 1; i <= n; i++) 
        for(int j = 1; j <= m; j++) cin >> b[i][j], B[i + j].push_back(b[i][j]);
    for(int i = 2; i <= n + m; i++) {
        sort(A[i].begin(), A[i].end());
        sort(B[i].begin(), B[i].end());
        if(A[i] != B[i]) {
            cout << "NO"; return 0;
        }
    }
    cout << "YES";
    return 0;
}