QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#884417#111. Amusement Park_8_8_Compile Error//C++203.6kb2025-02-06 05:17:012025-02-06 05:17:02

Judging History

This is the latest submission verdict.

  • [2025-02-06 05:17:02]
  • Judged
  • [2025-02-06 05:17:01]
  • Submitted

Joi

#include "Joi.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = (int)1e5 + 12, b = 60;

mt19937 rng1(123321);
vector<int> g1[N], G1[N];
int tin1[N], timer1;
bool vis1[N];
ll x;

void bfs1(int v) {
    queue<int> q;
    q.push(v);
    vis1[v] = 1;
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(int to : g1[v]) {
            if(!vis1[to]) {
                q.push(to);
                G1[v].push_back(to);
                vis1[to] = 1;
            }
        }
    }
}
void dfs1(int v) {
    tin1[v] = timer1++;
    vis1[v] = 1;
    MessageBoard(v, ((x >> (tin1[v] % 60)) & 1));
    for(int to : G1[v]) {
        if(!vis1[to]) {
            dfs1(to);
        }        
    }
}
void Joi(int n, int m, int A[], int B[], long long X, int T) {
    x = X;
    for(int i = 0; i < m; i++) {
        g1[A[i]].push_back(B[i]);
        g1[B[i]].push_back(A[i]);
    }
    for(int i = 0; i < n; i++) {
        sort(g1[i].begin(), g1[i].end());
    }
    bfs1(0);
    for(int i = 0; i < n; i++) {
        vis1[i] = 0;
    }
    dfs1(0);
}

Ioi

#include "Ioi.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = (int)1e5 + 12, b = 60;

mt19937 rng(123321);
ll d[N], mxd[N], pr[N], timer, sz[N];
vector<int> g[N], G[N];
int tin[N], bt[N], tout[N];
bool vis[N];

void bfs(int v) {
    queue<int> q;
    q.push(v);
    vis[v] = 1;
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(int to : g[v]) {
            if(!vis[to]) {
                G[v].push_back(to);
                q.push(to);
                vis[to] = 1;
            }
        }
    }
}
void dfs(int v) {
    tin[v] = timer++;
    tin[v] %= b;
    vis[v] = 1;
    sz[v] = 1;
    for(int to : G[v]) {
        if(!vis[to]) {
            pr[to] = v;
            dfs(to);
            sz[v] += sz[to];
        }        
    }
    tout[v] = timer;
    tout[v] %= b;
}

ll ans = 0;
bool check() {
    bool ret = true;
    for(int i = 0; i < b; i++) {
        if(bt[i] == -1) ret = false;
    }
    return ret;
}
bool ok = 1;
void go(int v, int val) {
    bt[tin[v]] = val;
    vis[v] = 1;
    if(check()) {
        return;
    }
    for(int to : G[v]) {
        if(!vis[to]) {
            bool ok = 1;
            for(int j = min(tin[to], tout[to]); j <= max(tin[to], tout[to]); j++) {
                if(bt[j] == -1) {
                    ok = 0;
                }
            }
            if(ok) continue;
            go(to, Move(to));
            if(check()) return;
        }
    }
    go(pr[v], Move(pr[v]));
    vector<int> nv;
    bool ok = 0;
    for(int to : G[pr[v]]) {
        if(to == v) {
            ok = 1;
        } else {
            if(ok) {
                nv.push_back(to);
            }
        }
    }
    for(int to : G[pr[v]]) {
        if(to == v) break;
        nv.push_back(to);
    }
    G[pr[v]] = nv;
}
long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
    for(int i = 0; i < m; i++) {
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    for(int i = 0; i < n; i++) {
        sort(g[i].begin(), g[i].end());
    }
    bfs(0);
    for(int i = 0; i < n; i++) vis[i] = 0;
    dfs(0);
    for(int i = 0; i < b; ++i) {
        bt[i] = -1;
    }
    for(int i = 0; i < n; i++) {
        vis[i] = 0;
    }
    go(P, V);
    for(int i = 0; i < b; i++) {
        if(bt[i]) {
            ans += (1ll << i);
        }
    }
    return ans;
}

詳細信息

Ioi.code:9:1: error: ‘mt19937’ does not name a type
    9 | mt19937 rng(123321);
      | ^~~~~~~
Ioi.code: In function ‘void bfs(int)’:
Ioi.code:22:22: warning: range-based ‘for’ loops only available with ‘-std=c++11’ or ‘-std=gnu++11’
   22 |         for(int to : g[v]) {
      |                      ^
Ioi.code:22:25: error: forming reference to reference type ‘std::vector<int>&’
   22 |         for(int to : g[v]) {
      |                         ^
Ioi.code: In function ‘void dfs(int)’:
Ioi.code:36:18: warning: range-based ‘for’ loops only available with ‘-std=c++11’ or ‘-std=gnu++11’
   36 |     for(int to : G[v]) {
      |                  ^
Ioi.code:36:21: error: forming reference to reference type ‘std::vector<int>&’
   36 |     for(int to : G[v]) {
      |                     ^
Ioi.code: In function ‘void go(int, int)’:
Ioi.code:62:18: warning: range-based ‘for’ loops only available with ‘-std=c++11’ or ‘-std=gnu++11’
   62 |     for(int to : G[v]) {
      |                  ^
Ioi.code:62:21: error: forming reference to reference type ‘std::vector<int>&’
   62 |     for(int to : G[v]) {
      |                     ^
Ioi.code:78:18: warning: range-based ‘for’ loops only available with ‘-std=c++11’ or ‘-std=gnu++11’
   78 |     for(int to : G[pr[v]]) {
      |                  ^
Ioi.code:78:25: error: forming reference to reference type ‘std::vector<int>&’
   78 |     for(int to : G[pr[v]]) {
      |                         ^
Ioi.code:87:18: warning: range-based ‘for’ loops only available with ‘-std=c++11’ or ‘-std=gnu++11’
   87 |     for(int to : G[pr[v]]) {
      |                  ^
Ioi.code:87:25: error: forming reference to reference type ‘std::vector<int>&’
   87 |     for(int to : G[pr[v]]) {
      |                         ^
grader_Ioi.cpp: In function ‘int Move(int)’:
grader_Ioi.cpp:36:7: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |  scanf("%d", &x);
      |  ~~~~~^~~~~~~~~~
grader_Ioi.cpp: In function ‘int main()’:
grader_Ioi.cpp:43:7: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |  scanf("%d%d%d%d%d", &N, &M, &P, &X, &T);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader_Ioi.cpp:45:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |   scanf("%d %d", &A[i], &B[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~