QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#289896 | #7866. Teleportation | ucup-team1766# | WA | 1ms | 3452kb | C++23 | 870b | 2023-12-24 03:56:02 | 2023-12-24 03:56:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x; cin >> n >> x;
vector<int> a(n); for (int &i : a) cin >> i;
vector<bool> seen(n);
set<int> next = {a[0]};
for (int _ = 1; _ <= n; _++) {
set<int> next2;
for (int i : next) {
if (i == x) {
cout << _ << '\n';
return 0;
}
seen[i] = true;
if (!seen[(i+a[i])%n]) {
next2.emplace((i+a[i])%n);
} else if (!seen[(i+1) % n]) {
next2.emplace((i+1) % n);
}
}
next = next2;
}
assert(0);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3452kb
input:
4 3 0 1 2 3
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
4 3 0 0 0 0
output:
4
result:
ok 1 number(s): "4"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3452kb
input:
4 3 2 2 2 2
output:
4
result:
wrong answer 1st numbers differ - expected: '2', found: '4'