QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#721075#8644. Tricolor LightshhoppitreeCompile Error//C++172.1kb2024-11-07 15:10:132024-11-07 15:10:14

Judging History

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

  • [2024-11-07 15:10:14]
  • 评测
  • [2024-11-07 15:10:13]
  • 提交

Anna

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

using namespace std;

const int L = 30;

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

    pair<string, int> anna(int n, string S) {
        if (n <= L) {
            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 + 1 < 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, 2 * L};
    }
}

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

Bruno

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

const int L = 30;

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 < 2 * L; ++j) {
                o += "012"[v[i + j * 2]];
                if (j == 2 * L - 2 || j == 2 * L - 1) 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;
    }
}

Details

Bruno.code:9:5: error: ‘map’ does not name a type
    9 |     map<string, int> M;
      |     ^~~
Bruno.code: In function ‘void Bruno::init(int, int)’:
Bruno.code:13:9: error: ‘mt19937’ was not declared in this scope; did you mean ‘std::mt19937’?
   13 |         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:14:44: error: ‘rnd’ was not declared in this scope; did you mean ‘rand’?
   14 |         for (int i = 0; i < n; ++i) v[i] = rnd() % 3;
      |                                            ^~~
      |                                            rand
Bruno.code:16:13: error: ‘string’ was not declared in this scope
   16 |             string o;
      |             ^~~~~~
Bruno.code:16: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:18:17: error: ‘o’ was not declared in this scope
   18 |                 o += "012"[v[i + j * 2]];
      |                 ^
Bruno.code:19:55: error: ‘M’ was not declared in this scope
   19 |                 if (j == 2 * L - 2 || j == 2 * L - 1) M[o] = i + 1;
      |                                                       ^
Bruno.code: At global scope:
Bruno.code:28:15: error: ‘string’ was not declared in this scope
   28 |     int bruno(string s) {
      |               ^~~~~~
Bruno.code:28: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>;
      |           ^~~~~~