QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#404956 | #3013. XOR Sequences | Lspeed# | WA | 7ms | 5796kb | C++14 | 2.6kb | 2024-05-05 03:05:59 | 2024-05-05 03:06:00 |
Judging History
answer
#include <iostream> // Input/output stream objects
#include <fstream> // File stream objects
#include <sstream> // String stream objects
#include <iomanip> // Input/output manipulators
#include <string> // String class and functions
#include <vector> // Dynamic array
#include <list> // Doubly linked list
#include <set> // Set container
#include <map> // Map container
#include <queue> // Queue container
#include <stack> // Stack container
#include <algorithm> // Algorithms on sequences (e.g., sort, find)
#include <cmath> // Mathematical functions
#include <ctime> // Date and time functions
#include <cstdlib> // General purpose functions (e.g., memory management)
#include <cstring> // C-style string functions
#include <cctype> // Character classification functions
#include <cassert> // Assert function for debugging
#include <exception> // Standard exceptions
#include <functional> // Function objects
#include <iterator> // Iterator classes
#include <limits> // Numeric limits
#include <locale> // Localization and internationalization
#include <numeric> // Numeric operations (e.g., accumulate)
#include <random> // Random number generators
#include <stdexcept> // Standard exception classes
#include <typeinfo> // Runtime type information
#include <utility> // Utility components (e.g., std::pair)
#include <bitset>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < (b); i++)
#define FORE(i, a, b) for(int i = a; i <= (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define x first
#define y second
#define mp make_pair
#define PI 3.141592653
const double eps = 1e-9;
const int N = 3e5;
int m, n;
vector<ll> num(N);
ll solve(int l, int r) {
if (l == r) return 1;
int mid = l + r >> 1;
bool chk = true;
FORE (i, l, mid) if (num[i] != num[i+(r-l+1)/2]) {
chk = false;
break ;
}
if (chk) return 2LL * solve(l, mid);
else {
set<int> left;
FORE (i, l, mid) left.insert(num[i]);
FORE (i, mid + 1, r) if (left.find(num[i]) != left.end()) return 0;
return solve(l, mid) * solve(mid + 1, r);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> m >> n;
vector<int> cnt(n+5, 0);
FORE (i, 1, (1 << m)) {
cin >> num[i];
cnt[num[i]] = 1;
}
FORE (i, 1, n) if (cnt[i] == 0) {
cout << "0" << endl;
return 0;
}
cout << solve(1, (1 << m)) << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 5224kb
input:
4 12 2 2 3 6 1 12 1 12 9 7 5 5 4 8 10 11
output:
8
result:
ok answer is 8
Test #2:
score: 0
Accepted
time: 1ms
memory: 5296kb
input:
4 5 2 2 2 2 5 1 5 1 4 4 3 3 4 4 3 3
output:
64
result:
ok answer is 64
Test #3:
score: 0
Accepted
time: 1ms
memory: 5276kb
input:
4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
16
result:
ok answer is 16
Test #4:
score: 0
Accepted
time: 0ms
memory: 5228kb
input:
0 1 1
output:
1
result:
ok answer is 1
Test #5:
score: 0
Accepted
time: 1ms
memory: 5352kb
input:
1 1 1 1
output:
2
result:
ok answer is 2
Test #6:
score: 0
Accepted
time: 1ms
memory: 5352kb
input:
1 2 2 1
output:
1
result:
ok answer is 1
Test #7:
score: 0
Accepted
time: 2ms
memory: 5364kb
input:
2 3 2 2 3 1
output:
2
result:
ok answer is 2
Test #8:
score: 0
Accepted
time: 1ms
memory: 5368kb
input:
2 3 2 1 2 3
output:
0
result:
ok answer is 0
Test #9:
score: -100
Wrong Answer
time: 7ms
memory: 5796kb
input:
16 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2552 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2551 2550 2550 2550 2550 2550 2550 2550 2550 2550 2550 25...
output:
0
result:
wrong answer expected 596575534, found 0