QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#404954 | #3013. XOR Sequences | Lspeed# | WA | 10ms | 5660kb | C++14 | 2.7kb | 2024-05-05 02:58:52 | 2024-05-05 02:58:53 |
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;
// cout << l << " L R " << r << endl;
FORE (i, l, mid) {
// cout << "INSERT " << num[i] << endl;
left.insert(num[i]);
}
FORE (i, mid + 1, r) {
// cout << "CHECK " << num[i] << endl;
if (left.find(num[i]) != left.end()) return 0;
}
// cout << l << " " << r << " NOT 0 " << endl;
return solve(l, mid) * solve(mid + 1, r);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> m >> n;
FORE (i, 1, (1 << m)) cin >> num[i];
cout << solve(1, (1 << m)) << endl;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 5344kb
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: 0ms
memory: 5364kb
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: 5272kb
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: 5220kb
input:
0 1 1
output:
1
result:
ok answer is 1
Test #5:
score: 0
Accepted
time: 2ms
memory: 5176kb
input:
1 1 1 1
output:
2
result:
ok answer is 2
Test #6:
score: 0
Accepted
time: 1ms
memory: 5344kb
input:
1 2 2 1
output:
1
result:
ok answer is 1
Test #7:
score: 0
Accepted
time: 1ms
memory: 5344kb
input:
2 3 2 2 3 1
output:
2
result:
ok answer is 2
Test #8:
score: 0
Accepted
time: 1ms
memory: 5364kb
input:
2 3 2 1 2 3
output:
0
result:
ok answer is 0
Test #9:
score: -100
Wrong Answer
time: 10ms
memory: 5660kb
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