QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#26026#2833. HamiltonHakujitsuCompile Error//C++1.7kb2022-04-05 21:56:402022-05-18 04:19:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-18 04:19:35]
  • 评测
  • [2022-04-05 21:56:40]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

void debug_out() {cerr << endl;}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{
    cerr << " " << H;
    debug_out(T...);
}
#ifndef ONLINE_JUDGE
    #define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 42
#endif

int n;

void solve(){
    vector<string> mp(n);
    for (auto &s : mp) cin >> s;
    vector<int> res;
    for (int i = 0; i < n; i += 1) {
        if(res.empty()) {
            res.emplace_back(i);
            continue;
        }
        int zero = 0;
        int one = 0;
        for (int j = 1; j < res.size(); j += 1) {
            if(mp[res[j - 1]][res[j]] == '0') zero += 1;
            else one += 1;
        }
        if(zero == 0) {
            res.insert(res.begin(), i);
            continue;
        }
        if(one == 0) {
            res.emplace_back(i);
            continue;
        }
        int j = 0;
        for (; j + 1 < res.size(); j += 1) {
            if(mp[res[j]][res[j + 1]] == '1') {
                break;
            }
        }
        if(mp[res[j - 1]][i] == '0' || mp[res[j]][i] == '1') {
            res.insert(res.begin() + j, i);
            continue;
        }
        if(mp[res[j]][i] == '0' || mp[res[j + 1]][i] == '1'){
            res.insert(res.begin() + j + 1, i);
            continue; == '1'
        }
        assert(0);
    }
    for (int i = 0; i < n; i += 1) {
        cout << res[i] + 1 << " \n"[i + 1 == n];
    }
}

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    while(cin >> n) {
        solve();
    }
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:55:23: error: expected primary-expression before ‘==’ token
   55 |             continue; == '1'
      |                       ^~