Submission #238199

# Submission time Handle Problem Language Result Execution time Memory
238199 2020-06-10T07:43:22 Z NONAME Dojave (COCI17_dojave) C++17
28 / 140
4000 ms 16760 KB
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) int(x.size())
#define el '\n'
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
using namespace std;

typedef long long ll;

const int N = (1 << 21);

ll n, a[N], ans;
bool mk[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;
    n = 1 << n;

    for (int i = 0; i < n; ++i)
        cin >> a[i];

    int fx = n - 1;

    for (int i = 0; i < n; ++i) {
        int cur = 0;
        for (int j = i; j < n; ++j) {
            cur ^= a[j];
            mk[a[j]] = 1;

            if (cur == fx) {
                if (j - i + 3 <= n || j - i + 1 > 1)
                    ans++;
            } else {
                bool ok = 0;

                for (int l = i; l <= j; ++l) {
                    int p = (cur ^ fx ^ a[l]);

                    ok |= !mk[p];
                }

                ans += ok;
            }
        }

        for (int j = 0; j < n; ++j)
            mk[j] = 0;
    }

    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4097 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4074 ms 512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4086 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4080 ms 1280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4098 ms 1280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4098 ms 4344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4086 ms 16632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4099 ms 16760 KB Time limit exceeded
2 Halted 0 ms 0 KB -