QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#603672#7866. TeleportationPHarrCompile Error//C++201002b2024-10-01 18:16:052024-10-01 18:16:06

Judging History

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

  • [2024-10-01 18:16:06]
  • 评测
  • [2024-10-01 18:16:05]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using i32 = int32_t;
using i64 = long long;

#define int i64

using vi = vector<int>;
using pii = pair<int, int>;

const i32 inf = INT_MAX / 2;


i32 main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vi a(n);
    for (auto &i: a) cin >> i;

    vector dis(n, vi(2, inf));
    vector vis(n, vi(2));

    queue<pii> q;


    dis[0][0] = 0;
    q.emplace(0, 0);
    while (not q.empty()) {
        auto [x, t] = q.front();
        q.pop();
        if (vis[x][t]) continue;
        vis[x][t] = 1;
        int y = (x + a[x]) % n;
        if (dis[y][1] > dis[x][t] + 1) {
            dis[y][1] = dis[x][t] + 1;
            q.emplace(y, 1);
        }

        y = (x + 1) % n;
        if (t == 1 and dis[y][1] > dis[x][1] + 1) {
            dis[y][1] = dis[x][1] + 1;
            q.emplace(y, 1);
        }
    }
    cout << ranges::min(dis[k]);
    return 0;
}
 

详细

answer.code:51:1: error: extended character   is not valid in an identifier
   51 |  
      | ^
answer.code:51:1: error: ‘ ’ does not name a type
   51 |  
      | ^