QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#289896#7866. Teleportationucup-team1766#WA 1ms3452kbC++23870b2023-12-24 03:56:022023-12-24 03:56:02

Judging History

你现在查看的是最新测评结果

  • [2023-12-24 03:56:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3452kb
  • [2023-12-24 03:56:02]
  • 提交

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'