QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#437565 | #8771. Dihedral Group | ucup-team045# | RE | 5ms | 4008kb | C++20 | 946b | 2024-06-09 13:32:05 | 2024-06-09 13:32:05 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
using LL = long long;
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for(int i = 0; i < n; i++)
cin >> a[i], a[i]--;
for(int i = 0; i < n; i++)
cin >> b[i], b[i]--;
auto check = [&](vector<int> a){
vector<int> p(n);
for(int i = 0; i < n; i++) p[a[i]] = i;
int st = p[b[0]];
for(int j = 0; j < m; j++){
int pos = (st + j) % n;
if (a[pos] != b[j]) return false;
}
return true;
};
if (check(a)){
cout << 1 << '\n';
return 0;
}
reverse(a.begin(), a.end());
cout << check(a) << '\n';
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
3 3 1 2 3 1 3 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
3 1 1 2 3 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 2 1 2 3 4 1 3
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
4 4 1 2 3 4 2 3 4 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 4 1 2 3 4 3 2 1 4
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
5 3 1 3 5 4 2 2 1 3
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
5 4 1 3 5 4 2 2 1 5 3
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 1 1 1
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3844kb
input:
50000 50000 22577 42400 21546 3302 14673 38530 22117 34658 9767 8284 18979 21312 30964 13861 9502 17302 9772 23092 18502 26861 33431 46434 42862 33662 16736 26383 42119 18487 6112 34272 40503 9340 36859 22828 35809 1442 37730 28378 12422 12305 26736 32865 691 29405 7395 24658 20995 40821 23979 15723...
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 5ms
memory: 3884kb
input:
50000 50000 35130 7093 5888 13405 6205 14721 28267 16125 2951 48393 3592 9734 38272 14933 44581 48795 19209 48236 43907 12756 16959 41111 5430 21055 49060 925 37384 32101 5585 34643 36209 2236 22459 22364 17276 18146 25061 49067 46552 12258 8427 26462 13673 17506 30884 48643 22278 2383 12787 8607 47...
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 5ms
memory: 3840kb
input:
50000 50000 11452 47769 1305 22064 3040 20136 23013 10726 33785 5837 30028 4914 47911 16748 106 3373 6501 24664 16564 33298 15686 10750 27147 30460 8673 47664 26479 5700 16691 12422 23705 24809 15591 38417 12384 5546 12014 15751 47462 7043 43259 3836 9164 33496 40840 2812 11129 22541 41309 28222 219...
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 2ms
memory: 4008kb
input:
50000 50000 39318 18761 41072 14961 39514 45083 42960 5383 37971 8807 34879 49057 5538 196 5401 11979 33008 2101 31411 15125 6988 14984 37653 4858 1696 33907 31532 4521 18931 36899 15799 33452 41430 6909 20829 37430 16960 16578 24459 45203 38747 35859 22493 8368 4451 22357 22771 8344 38053 1210 3999...
output:
1
result:
ok single line: '1'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3988kb
input:
50000 50000 22354 8925 44766 46620 29461 29861 34125 28812 17123 27288 1807 5544 46652 40596 11730 32137 968 40681 2627 29169 5317 18657 10736 41992 9803 14611 22509 39597 12160 3499 6939 18501 11722 1234 16191 48253 45266 32765 9561 19467 40703 6444 2230 25667 13825 2409 11519 37424 32531 19582 240...
output:
1
result:
ok single line: '1'
Test #14:
score: 0
Accepted
time: 5ms
memory: 3856kb
input:
50000 50000 19141 15348 4931 30402 22085 854 42879 14859 24742 36869 45006 12955 13372 1557 16223 38574 31130 44141 37756 9938 15969 29363 4840 26784 24986 31279 32778 19907 40494 30060 21943 46922 25712 17589 41974 30109 31553 41838 18325 30978 9996 30186 27911 42513 49822 16654 22943 15892 41868 4...
output:
1
result:
ok single line: '1'
Test #15:
score: -100
Runtime Error
input:
50000 5511 32911 17093 8964 9015 11417 2632 4777 4287 9855 4226 25271 28347 24594 38939 28090 33526 23926 17367 625 47785 3245 33072 17330 21373 10673 26556 42245 1344 41985 18351 13400 29099 5338 23659 48106 30697 26206 44699 45360 17390 27504 40276 39113 33120 8488 3633 21944 20214 20733 19706 448...