QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#720993#8644. Tricolor LightshhoppitreeCompile Error//C++172.1kb2024-11-07 14:55:122024-11-07 14:55:14

Judging History

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

  • [2024-11-07 14:55:14]
  • 评测
  • [2024-11-07 14:55:12]
  • 提交

Anna

#include <bits/stdc++.h>
#include "Anna.h"

using namespace std;

namespace Anna {
    int v[1 << 20];

    pair<string, int> anna(int n, string S) {
        if (n <= 28) {
            string T;
            for (int i = 0; i < n; ++i) {
                T += (S[i] == 'R' ? 'G' : 'R');
            }
            return {T, n};
        }
        mt19937 rnd;
        for (int i = 0; i < n; ++i) v[i] = rnd() % 3;
        string T;
        for (int i = 0; i < n; i += 2) {
            int ok = 0;
            for (int j = 0; j < 3 && !ok; ++j) {
                for (int k = 0; k < 3; ++k) {
                    if ((j + k) % 3 != v[i] || "RGB"[j] == S[i] || "RGB"[k] == S[i + 1]) {
                        continue;
                    }
                    T += "RGB"[j];
                    T += "RGB"[k];
                    ok = 1;
                    break;
                }
            }
        }
        if (n & 1) {
            T += (S.back() == 'R' ? 'G' : 'R');
        }
        return {T, 28};
    }
}

pair<string, int> anna(int n, string S) {
    return Anna::anna(n, S);
}

Bruno

#include <bits/stdc++.h>
#include "Bruno.h"

namespace Bruno {
    int n, m, v[1 << 20];

    map<string, int> M;

    void init(int _n, int _m) {
        n = _n, m = _m;
        mt19937 rnd;
        for (int i = 0; i < n; ++i) v[i] = rnd() % 3;
        for (int i = 0; i < n; i += 2) {
            string o;
            for (int j = 0; j < 14; ++j) {
                o += "012"[v[i + j * 2]];
                if (j == 12 || j == 13) M[o] = i + 1;
            }
        }
    }

    int tr(char c) {
        return (c == 'R' ? 0 : (c == 'G' ? 1 : 2));
    }

    int bruno(string s) {
        if (n == m) return 1;
        for (int i = 0; i < 2; ++i) {
            string T;
            for (int j = i; j + 1 < m; j += 2) {
                T += "012"[(tr(s[j]) + tr(s[j + 1])) % 3];
            }
            if (M.count(T)) return M[T] - i;
        }
        return -1;
    }
}

void init(int n, int l) {
    Bruno::init(n, l);
}

int bruno(string s) {
    return Bruno::bruno(s);
}

Details

Bruno.code:7:5: error: ‘map’ does not name a type
    7 |     map<string, int> M;
      |     ^~~
Bruno.code: In function ‘void Bruno::init(int, int)’:
Bruno.code:11:9: error: ‘mt19937’ was not declared in this scope; did you mean ‘std::mt19937’?
   11 |         mt19937 rnd;
      |         ^~~~~~~
      |         std::mt19937
In file included from /usr/include/c++/11/random:49,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:108,
                 from Bruno.code:1:
/usr/include/c++/11/bits/random.h:1578:37: note: ‘std::mt19937’ declared here
 1578 |     0xefc60000UL, 18, 1812433253UL> mt19937;
      |                                     ^~~~~~~
Bruno.code:12:44: error: ‘rnd’ was not declared in this scope; did you mean ‘rand’?
   12 |         for (int i = 0; i < n; ++i) v[i] = rnd() % 3;
      |                                            ^~~
      |                                            rand
Bruno.code:14:13: error: ‘string’ was not declared in this scope
   14 |             string o;
      |             ^~~~~~
Bruno.code:14:13: note: suggested alternatives:
In file included from /usr/include/c++/11/iosfwd:39,
                 from /usr/include/c++/11/ios:38,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Bruno.code:1:
/usr/include/c++/11/bits/stringfwd.h:79:33: note:   ‘std::string’
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Bruno.code:1:
/usr/include/c++/11/string:67:11: note:   ‘std::pmr::string’
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
Bruno.code:16:17: error: ‘o’ was not declared in this scope
   16 |                 o += "012"[v[i + j * 2]];
      |                 ^
Bruno.code:17:41: error: ‘M’ was not declared in this scope
   17 |                 if (j == 12 || j == 13) M[o] = i + 1;
      |                                         ^
Bruno.code: At global scope:
Bruno.code:26:15: error: ‘string’ was not declared in this scope
   26 |     int bruno(string s) {
      |               ^~~~~~
Bruno.code:26:15: note: suggested alternatives:
In file included from /usr/include/c++/11/iosfwd:39,
                 from /usr/include/c++/11/ios:38,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Bruno.code:1:
/usr/include/c++/11/bits/stringfwd.h:79:33: note:   ‘std::string’
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Bruno.code:1:
/usr/include/c++/11/string:67:11: note:   ‘std::pmr::string’
   67 |     using string    = basic_string<char>;
      |           ^~~~~~
Bruno.code:43:11: error: ‘int bruno’ redeclared as different kind of entity
   43 | int bruno(string s) {
      |           ^~~~~~
In file included from Bruno.code:2:
Bruno.h:6:5: note: previous declaration ‘int bruno(std::string)’
    6 | int bruno(std::string u);
      |     ^~~~~
Bruno.code:43:11: error: ‘string’ was not declared in this scope
   43 | int bruno(string s) {
      |           ^~~~~~
Bruno.code:43:11: note: suggested alternatives:
In file included from /usr/include/c++/11/iosfwd:39,
                 from /usr/include/c++/11/ios:38,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from Bruno.code:1:
/usr/include/c++...