QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508877#7900. Gifts from Knowledgeucup-team3591Compile Error//C++204.0kb2024-08-07 21:06:122024-08-07 21:06:13

Judging History

你现在查看的是最新测评结果

  • [2024-08-07 21:06:13]
  • 评测
  • [2024-08-07 21:06:12]
  • 提交

answer

//  __      __          ___                                         ___    __ __
// /\ \  __/\ \        /\_ \                                      /'___'\ /\ \ \
// \ \ \/\ \ \ \     __\//\ \     ___    ___     ___ ___      __ /\_\ /\ \ \ \ \       __   __  __     __   _ __
//  \ \ \ \ \ \ \  /'__'\ \ \   /'___\ / __'\ /' __' __'\  /'__'\/_/// /__\ \ \ \_   /'__'\/\ \/\ \  /'__'\/\''__\
//   \ \ \_/ \_\ \/\  __/ \_\ \_/\ \__//\ \L\ \/\ \/\ \/\ \/\  __/  // /_\ \ \__ ,__\/\  __/\ \ \_/ |/\  __/\ \ \/
//    \ '\___x___/\ \____\/\____\ \____\ \____/\ \_\ \_\ \_\ \____\/\______/ \/_/\_\_/\ \____\ \___/ \ \____\ \_\
//     '\/__//__/  \/____/\/____/\/____/\/___/  \/_/\/_/\/_/\/____/\/_____/     \/_/   \/____/ \/__/   \/____/ \/_/
//   bilibili:24Records
//   link:https://space.bilibili.com/3546387113314828
//   blog link:https://welcome24ever.github.io/24Records/
//
//   Then,we just singing like.
//   Welcome To Forever.
#include "bits/stdc++.h"
using namespace std;
const int Welcome24ever = 0;
#define endl '\n'
#define fixset(x) fixed << setprecision(x)
//#define int long long
typedef long long ll; typedef pair<int,int> PII;
long double pi = acos(-1);
const int MOD = 1e9 + 7; const int N = 2e5+10;
void NeverSayNever() {
    int n, m;
    cin >> n >> m;
    vector<string> mp(n + 1);
    for (int i = 1; i <= n; i++) {
        string str;
        cin >> str;
        mp[i] = ' ' + str;
    }
    vector<vector<int>> one(m + 2);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (mp[i][j] == '1') {
                one[j].push_back(i);
            }
        }
    }
    if (m % 2 == 1) {
        if (one[m / 2 + 1].size() > 1) {
            cout << 0 << endl;
            return;
        }
    }
    vector<vector<int>> adj(n * 2 + 2);
    for (int i = 1; i <= n; ++i) {
        adj[i].push_back(i + n);
        adj[i + n].push_back(i);
    }
    bool flag = false;
    for (int i = 1; i <= m / 2; ++i) {
        int cnt = one[i].size() + one[m - i + 1].size();
        if (cnt > 2) {
            flag = true;
            break;
        }
        if (cnt < 2) {
            continue;
        }
        if (one[i].size() == 1) {
            int cur = one[i][0];
            int nxt = one[m - i + 1][0];
            if (cur == nxt) continue;
            adj[cur].push_back(nxt + n);
            adj[nxt + n].push_back(cur);
            adj[nxt].push_back(cur + n);
            adj[cur + n].push_back(nxt);
        } else {
            int cur, nxt;
            if (one[i].size() != 0) {
                cur = one[i][0];
                nxt = one[i][1];
            } else {
                cur = one[m - i + 1][0];
                nxt = one[m - i + 1][1];
            }
            adj[cur].push_back(nxt);
            adj[nxt].push_back(cur);
            adj[cur + n].push_back(nxt + n);
            adj[nxt + n].push_back(cur + n);
        }
    }
    if (flag) {
        cout << 0 << endl;
        return;
    }
    int ans = 1;
    vector<int> color(2 * n + 2, 0);
    auto dfs = [&](auto &&self, int cur, int fa) -> bool {
        for (auto &nxt: adj[cur]) {
            if (color[cur] == color[nxt]) {
                return false;
            }
            if (color[nxt]) {
                continue;
            }
            if (color[cur] == 1) {
                color[nxt] = 2;
            } else {
                color[nxt] = 1;
            }
            if (self(self, nxt, cur) == false) {
                return false;
            }
        }
        return true;
    };
    for (int i = 1; i <= 2 * n; i++) {
        if (color[i] != 0) {
            continue;
        }
        color[i] = 1;
        bool f =dfs(dfs, i, i);
        if (f) {
            ans = ans * 2 % MOD;
        }
    }
    cout << ans << endl;
}
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        NeverSayNever();
    }
    retur

Details

answer.code: In function ‘int main()’:
answer.code:129:5: error: ‘retur’ was not declared in this scope
  129 |     retur
      |     ^~~~~
answer.code:129:10: error: expected ‘}’ at end of input
  129 |     retur
      |          ^
answer.code:121:15: note: to match this ‘{’
  121 | signed main() {
      |               ^