QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#108536 | #6506. Chase Game 3 | keainie# | TL | 8ms | 13040kb | C++14 | 497b | 2023-05-25 14:08:13 | 2023-05-25 14:08:14 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <vector>
const int N = 4e5 + 10;
int n, a[N];
std::vector<int> g[N];
bool abl[N];
void work()
{
std::cin >> n;
for (int i = 1; i <= n; ++ i) abl[i] = false;
for (int i = 1; i <= n; ++ i) scanf("%d", &a[i]);
bool flag = true;
for (int i = 1; i <= n; ++ i) flag &= a[i] == i;
if (flag) return puts("Yes"), void();
puts(n <= 3 ? "Yes" : "No");
}
int main()
{
int T;
std::cin >> T;
while (T --) work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 12744kb
input:
5 2 1 2 3 2 3 1 4 1 4 3 2 5 1 5 2 3 4 6 1 2 3 4 5 6
output:
Yes Yes No No Yes
result:
ok 5 token(s): yes count is 3, no count is 2
Test #2:
score: 0
Accepted
time: 4ms
memory: 13040kb
input:
8 2 1 2 2 2 1 3 1 2 3 3 3 1 2 3 2 1 3 3 2 3 1 3 3 2 1 3 1 3 2
output:
Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 8 token(s): yes count is 8, no count is 0
Test #3:
score: -100
Time Limit Exceeded
input:
100000 4 4 1 3 2 4 3 2 4 1 4 3 2 1 4 4 2 4 3 1 4 1 2 3 4 4 2 3 1 4 4 1 3 4 2 4 3 4 1 2 4 1 3 2 4 4 1 4 3 2 4 3 4 2 1 4 3 2 4 1 4 4 2 3 1 4 3 2 4 1 4 4 1 2 3 4 3 2 1 4 4 4 1 3 2 4 1 3 4 2 4 1 4 2 3 4 2 4 3 1 4 2 3 1 4 4 4 2 3 1 4 2 1 3 4 4 3 1 2 4 4 1 2 3 4 4 4 3 2 1 4 3 4 1 2 4 1 3 2 4 4 4 2 1 3 4 3...
output:
No No No No Yes No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No...