QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#404958 | #3013. XOR Sequences | Lspeed# | AC ✓ | 65ms | 8748kb | C++14 | 2.7kb | 2024-05-05 03:10:22 | 2024-05-05 03:10:23 |
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;
const ll mod = 1e9 + 7;
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)) % mod;
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)) % mod;
}
}
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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5292kb
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: 5288kb
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: 5340kb
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: 5284kb
input:
0 1 1
output:
1
result:
ok answer is 1
Test #5:
score: 0
Accepted
time: 1ms
memory: 5172kb
input:
1 1 1 1
output:
2
result:
ok answer is 2
Test #6:
score: 0
Accepted
time: 1ms
memory: 5212kb
input:
1 2 2 1
output:
1
result:
ok answer is 1
Test #7:
score: 0
Accepted
time: 1ms
memory: 5300kb
input:
2 3 2 2 3 1
output:
2
result:
ok answer is 2
Test #8:
score: 0
Accepted
time: 1ms
memory: 5176kb
input:
2 3 2 1 2 3
output:
0
result:
ok answer is 0
Test #9:
score: 0
Accepted
time: 10ms
memory: 5664kb
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:
596575534
result:
ok answer is 596575534
Test #10:
score: 0
Accepted
time: 3ms
memory: 5256kb
input:
16 647 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 190 190 190 190 190 190 190 190 149 149 149 149 149 149 149 149 190 190 190 190 190 190 190 190 149 1...
output:
883211652
result:
ok answer is 883211652
Test #11:
score: 0
Accepted
time: 3ms
memory: 5328kb
input:
16 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
974740338
result:
ok answer is 974740338
Test #12:
score: 0
Accepted
time: 4ms
memory: 5276kb
input:
16 16 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...
output:
978747134
result:
ok answer is 978747134
Test #13:
score: 0
Accepted
time: 3ms
memory: 5220kb
input:
16 16 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...
output:
487761806
result:
ok answer is 487761806
Test #14:
score: 0
Accepted
time: 4ms
memory: 5176kb
input:
16 17 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...
output:
489373567
result:
ok answer is 489373567
Test #15:
score: 0
Accepted
time: 60ms
memory: 8132kb
input:
16 52361 26988 51822 45167 17373 49212 14325 34575 52354 35631 50239 36790 52350 8802 46009 50010 47588 42797 46395 42797 46395 40654 20412 48888 48888 26581 34567 22029 22029 19970 45614 18366 18366 17163 26564 45082 26166 15479 33436 329 329 33854 26248 37775 6536 52323 52323 4089 30570 24208 2420...
output:
117465194
result:
ok answer is 117465194
Test #16:
score: 0
Accepted
time: 59ms
memory: 8748kb
input:
16 65536 55473 32701 13511 38981 9512 17597 22203 30263 44926 35075 44124 18851 31048 64346 27158 20745 40676 16101 7773 14416 26240 65515 21677 8375 63022 29250 53479 31055 20771 4954 26110 17283 61220 53404 33552 60001 36161 40692 9321 7700 41378 44316 14018 44886 31791 32758 23113 34455 30974 141...
output:
1
result:
ok answer is 1
Test #17:
score: 0
Accepted
time: 6ms
memory: 5324kb
input:
16 256 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44...
output:
409643880
result:
ok answer is 409643880
Test #18:
score: 0
Accepted
time: 7ms
memory: 5540kb
input:
16 1935 539 539 539 539 1057 1057 1057 1057 539 539 539 539 1057 1057 1057 1057 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 664 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 1027 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 1351 1351 13...
output:
127536394
result:
ok answer is 127536394
Test #19:
score: 0
Accepted
time: 4ms
memory: 5276kb
input:
16 195 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 74 74 74 74 74 74 74 74 33 33 33 33 33 33 33 33 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 5...
output:
39724215
result:
ok answer is 39724215
Test #20:
score: 0
Accepted
time: 7ms
memory: 5288kb
input:
16 783 665 665 665 665 665 665 665 665 413 413 413 413 413 413 413 413 665 665 665 665 665 665 665 665 413 413 413 413 413 413 413 413 665 665 665 665 665 665 665 665 413 413 413 413 413 413 413 413 665 665 665 665 665 665 665 665 413 413 413 413 413 413 413 413 665 665 665 665 665 665 665 665 413 4...
output:
436717605
result:
ok answer is 436717605
Test #21:
score: 0
Accepted
time: 0ms
memory: 5324kb
input:
3 6 5 3 2 6 1 1 4 4
output:
4
result:
ok answer is 4
Test #22:
score: 0
Accepted
time: 1ms
memory: 5216kb
input:
5 13 7 7 7 7 7 7 7 7 2 11 6 4 5 5 1 1 10 10 10 10 10 10 10 10 13 13 8 9 12 3 12 3
output:
1024
result:
ok answer is 1024
Test #23:
score: 0
Accepted
time: 1ms
memory: 5284kb
input:
6 13 1 1 2 2 7 7 7 7 9 9 13 13 8 8 8 8 3 3 11 11 3 3 11 11 6 6 6 6 6 6 6 6 10 4 10 4 12 12 12 12 10 4 10 4 12 12 12 12 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
output:
4194304
result:
ok answer is 4194304
Test #24:
score: 0
Accepted
time: 1ms
memory: 5348kb
input:
7 68 8 8 8 8 64 64 64 64 37 48 56 66 11 11 49 49 68 68 68 68 59 10 59 10 13 13 60 60 14 14 53 53 18 18 6 6 23 19 23 19 42 21 67 65 50 22 44 45 31 32 31 32 61 61 39 39 3 3 5 36 54 63 7 7 25 17 46 40 29 29 29 29 35 35 55 38 43 9 57 34 12 12 30 30 16 16 16 16 58 58 58 58 15 27 24 51 62 62 2 2 62 62 2 2...
output:
46480318
result:
ok answer is 46480318
Test #25:
score: 0
Accepted
time: 1ms
memory: 5176kb
input:
8 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
73741817
result:
ok answer is 73741817
Test #26:
score: 0
Accepted
time: 1ms
memory: 5292kb
input:
9 49 5 5 5 5 5 5 5 5 47 47 47 47 47 47 47 47 5 5 5 5 5 5 5 5 47 47 47 47 47 47 47 47 46 46 46 46 4 4 4 4 46 46 46 46 4 4 4 4 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 30 30 30 30 30 30 30 30 33 33 33 33 33 33 33 33 39 39 39 39 39 39 39 39 20 20 20 20 35 35 35 35 18 18 18 18 17 17 17 17 18 18 1...
output:
896465609
result:
ok answer is 896465609
Test #27:
score: 0
Accepted
time: 1ms
memory: 5364kb
input:
10 64 19 14 7 12 22 25 31 46 8 50 56 24 48 49 11 60 2 53 45 4 5 63 29 61 39 62 32 6 28 33 52 64 54 59 55 1 16 37 47 3 30 20 21 58 36 43 26 51 41 9 18 10 27 38 44 40 23 57 42 15 13 34 35 17 19 14 7 12 22 25 31 46 8 50 56 24 48 49 11 60 2 53 45 4 5 63 29 61 39 62 32 6 28 33 52 64 54 59 55 1 16 37 47 3...
output:
16
result:
ok answer is 16
Test #28:
score: 0
Accepted
time: 0ms
memory: 5296kb
input:
11 762 439 439 651 236 207 207 90 649 1 382 1 382 27 27 27 27 36 36 36 36 248 142 729 582 688 688 83 83 688 688 83 83 208 208 569 569 24 260 10 10 525 525 486 696 16 276 367 262 519 58 519 58 204 204 204 204 664 153 19 430 127 127 349 420 174 174 174 174 601 601 442 442 757 757 757 757 757 757 757 7...
output:
39724215
result:
ok answer is 39724215
Test #29:
score: 0
Accepted
time: 3ms
memory: 5344kb
input:
12 1479 183 183 118 118 437 437 578 765 305 305 305 305 305 305 305 305 716 716 716 716 716 716 716 716 1188 1188 1188 1188 620 620 1106 540 1328 1328 1328 1328 1328 1328 1328 1328 1126 1126 403 403 1126 1126 403 403 269 269 224 224 433 433 433 433 1466 1466 1466 1466 1466 1466 1466 1466 1237 166 12...
output:
937814008
result:
ok answer is 937814008
Test #30:
score: 0
Accepted
time: 2ms
memory: 5228kb
input:
13 396 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 75 75 75 75 75 75 75 75 395 395 395 395 395 395 395 395 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 75 75 75 75 75 75 75 75 395 395 395 395 395 395 395 395 239 239 239 239 239 239 239 239 239 239 239 239 239 2...
output:
842859955
result:
ok answer is 842859955
Test #31:
score: 0
Accepted
time: 2ms
memory: 5772kb
input:
14 4951 2865 2865 2865 2865 2865 2865 2865 2865 2271 2271 2271 2271 2271 2271 2271 2271 3682 3682 3682 3682 310 310 656 656 1218 1218 1218 1218 1218 1218 1218 1218 67 67 67 67 2345 2345 4614 4614 72 276 72 276 2121 2121 2847 3018 4280 4280 2450 2450 4652 4652 4652 4652 3208 3208 312 312 3034 3034 30...
output:
498151463
result:
ok answer is 498151463
Test #32:
score: 0
Accepted
time: 24ms
memory: 6812kb
input:
15 27203 9513 9513 26575 24670 27095 14488 18493 1040 18109 6885 18889 4812 12731 12731 2427 3882 20214 12403 17994 17994 17880 23915 7134 15931 27009 27009 20406 20406 16694 16694 16164 7244 18615 10090 21903 21903 23518 23518 8447 23227 22417 858 14463 14463 19410 14063 12699 13934 1496 1496 22226...
output:
684550435
result:
ok answer is 684550435
Test #33:
score: 0
Accepted
time: 61ms
memory: 8480kb
input:
16 58916 16289 53146 58914 22416 38195 49329 2376 2376 2596 6941 53789 46252 33403 33403 35014 50680 16209 44858 873 43569 13338 34650 24614 37528 12158 57357 29646 27545 29383 10178 57019 18987 46024 14513 1199 34183 1653 1653 27502 776 19498 36063 19498 36063 34249 39460 6267 49764 6825 42107 3279...
output:
181973755
result:
ok answer is 181973755
Test #34:
score: 0
Accepted
time: 9ms
memory: 5832kb
input:
16 2048 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 1861 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 527 ...
output:
446371492
result:
ok answer is 446371492
Test #35:
score: 0
Accepted
time: 3ms
memory: 5772kb
input:
16 2584 1868 1868 1413 2446 1868 1868 1413 2446 105 74 105 74 1989 1989 1424 2167 1868 1868 1413 2446 1868 1868 1413 2446 105 74 105 74 1989 1989 1424 2167 1529 2098 1529 2098 1806 1806 793 1093 1529 2098 1529 2098 1806 1806 793 1093 555 555 1709 1888 555 555 1709 1888 1820 2278 1820 2278 767 767 22...
output:
724522059
result:
ok answer is 724522059
Test #36:
score: 0
Accepted
time: 4ms
memory: 5356kb
input:
16 31 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 ...
output:
779974913
result:
ok answer is 779974913
Test #37:
score: 0
Accepted
time: 35ms
memory: 7036kb
input:
16 25600 4587 12833 7039 15676 12191 735 10896 10254 17899 22150 25241 8654 23349 18461 726 938 24924 12214 17647 23699 15766 17721 16327 3519 755 25586 3216 18566 7128 6794 9627 17252 19892 22874 2733 2413 791 10866 12752 14471 20687 605 1189 23100 12393 12085 24005 21427 24874 4767 17405 3436 7787...
output:
134217728
result:
ok answer is 134217728
Test #38:
score: 0
Accepted
time: 16ms
memory: 5728kb
input:
16 6542 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 3302 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 6242 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 3481 5393 5393 5393 5393 5393 5393 5393 5393 5393 5393 53...
output:
520728849
result:
ok answer is 520728849
Test #39:
score: 0
Accepted
time: 65ms
memory: 8516kb
input:
16 58992 50748 45232 54713 49171 40606 58987 28176 12464 38684 31394 38359 35220 54187 40949 38972 38972 53664 53664 13380 37776 7646 23835 721 11748 29239 46653 52378 32244 30354 58965 36680 13873 18035 31906 21608 58648 1757 3150 51689 51689 24129 51356 6183 55534 25960 5494 10008 37370 44953 2601...
output:
563345299
result:
ok answer is 563345299
Test #40:
score: 0
Accepted
time: 22ms
memory: 6332kb
input:
16 12870 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 12721 127...
output:
949866298
result:
ok answer is 949866298
Test #41:
score: 0
Accepted
time: 0ms
memory: 5296kb
input:
3 4 1 2 3 3 1 2 4 4
output:
0
result:
ok answer is 0