标题,你懂的(15.0)...

hhc0001deljbk / 2024-10-25 / 原文

邮寄

joker...

开场秒 A。

然后就不会做了...

A

随便乱搞都能过。

#include <bits/stdc++.h>
using namespace std;

int t, n, m;
vector<int> arr[110];

void solve() {
  cin >> n >> m;
  for(int i = 1; i <= n; i++) {
    arr[i].resize(m + 1);
    for(int j = 1; j <= m; j++) {
      cin >> arr[i][j];
    }
  }
  for(int j = 1; j <= m; j++) {
    stable_sort(arr + 1, arr + n + 1, [j](vector<int> a, vector<int> b) {return a[j] < b[j];});
    for(int i = 2; i <= n; i++) {
      for(int k = 1; k <= j; k++) {
        if(arr[i][k] < arr[i - 1][k]) {
          cout << "NO" << '\n';
          return ;
        }
      }
    }
  }
  cout << "YES" << '\n';
  /*
  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= m; j++) {
      cout << arr[i][j] << ' ';
    }
    cout << '\n';
  }
  //*/
}

int main() {
  freopen("exchange.in", "r", stdin);
  freopen("exchange.out", "w", stdout);
  for(cin >> t; t--; solve()) {
  }
  return 0;
}

B

~ 0 1 2
0 0 2 1
1 2 1 0
2 1 0 2

所以 \(x \otimes y = -(x + y) \bmod 3\)

#include <bits/stdc++.h>
using namespace std;

const int c[3][3] = {{1, 0, 0}, {1, 1, 0}, {1, 2, 1}};

int t, n, arr[200020], ans;
string s;

int C(int x, int y) {
  return x < 0 || y < 0? 0 : c[x][y];
}

int CC(int x, int y) {
  if(x < 3 && y < 3) {
    return C(x, y);
  }
  return C(x % 3, y % 3) * CC(x / 3, y / 3) % 3;
}

int main() {
  freopen("brick.in", "r", stdin);
  freopen("brick.out", "w", stdout);
  for(cin >> t; t--; ) {
    cin >> n >> s;
    for(int i = 0; i < s.size(); i++) {
      arr[i + 1] = s[i] - 'A';
    }
    ans = 0;
    for(int i = 1; i <= n; i++) {
      ans = ans + CC(n - 1, i - 1) * arr[i];
    }
    ans %= 3;
    if(!(n & 1)) {
      ans = (3 - ans) % 3;
    }
    cout << char(ans + 'A') << '\n';
  }
  return 0;
}