QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296666#7866. Teleportationsjw712WA 0ms3604kbC++14984b2024-01-03 12:57:472024-01-03 12:57:47

Judging History

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

  • [2024-01-03 12:57:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3604kb
  • [2024-01-03 12:57:47]
  • 提交

answer


#include <bits/stdc++.h>
 
#define x first
#define y second
#define el '\n'
#define debug(x) cerr << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 3e5 + 10, INF = 0x3f3f3f3f, mod = 998244353;
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, x; cin >> n >> x;
    vector<vector<int>> G(n);
    for (int i = 1; i < n - 1; ++i) G[i].emplace_back(i + 1);
    G[n - 1].emplace_back(0);
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        G[i].emplace_back((i + a[i]) % n);
    }
    queue<int> Q;
    vector<int> dis(n, INF);

        Q.push(0);
        dis[0] = 0;

    while (Q.size()) {
        int u = Q.front(); Q.pop();
        for (int v: G[u]) {
            if (dis[v] == INF) {
                dis[v] = dis[u] + 1;
                Q.push(v);
            }
        }
    }
    cout << dis[x] << el;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3604kb

input:

4 3
0 1 2 3

output:

1061109567

result:

wrong answer 1st numbers differ - expected: '4', found: '1061109567'