AcWing 每日一题 - 暑假

2021-07-12 21:03

阅读:375

标签:code   cpp   printf   get   resize   sync   题记   tor   下标   

本篇解题记录题源来自 AcWing 的每日一题 · 暑假

补题链接:Here

Week 1

星期四 AcWing 3761. 唯一最小数

利用 map 存出现过数的下标和次数即可

vectora;
int n;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int _; for (cin >> _; _--;) {
        int Min = INT_MAX, cnt = 0;
        mapmp, st;
        cin >> n;
        a.reserve(n + 1);
        for (int i = 1; i > a[i];
            mp[a[i]]++;
            st[a[i]] = i;
        }

        for (auto i : mp) {
            if (i.second == 1 and i.first 

星期五 AcWing 3762. 二进制矩阵

想错了。。。原来不是求最优解

既然不是最优解,那么直接从右上模拟到左下即可

int n, m;
vectorvs;

void print(int x, int y) {
    if (x + 1  m) {
        printf("%d %d %d %d %d %d\n", x, y, x, y - 1, x + 1, y);
        printf("%d %d %d %d %d %d\n", x, y, x, y - 1, x + 1, y - 1);
        printf("%d %d %d %d %d %d\n", x, y, x + 1, y, x + 1, y - 1);
    } else if (x + 1 > n && y + 1 sync_with_stdio(false);
    int _; for (cin >> _; _--;) {
        cin >> n >> m;
        vs.resize(n);
        for (string &x : vs)cin >> x;
        int cnt = 0;
        for (int i = 0; i 

AcWing 每日一题 - 暑假

标签:code   cpp   printf   get   resize   sync   题记   tor   下标   

原文地址:https://www.cnblogs.com/RioTian/p/14987753.html


评论


亲,登录后才可以留言!