QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#34679#4251. Gamejli505#Compile Error//C++202.0kb2022-06-12 04:38:252024-05-26 00:51:55

Judging History

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

  • [2024-05-26 00:51:55]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-12 04:38:25]
  • 提交

answer

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#include "game.h"
using namespace std;

void fastIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

int N, M, K;


vector<int> adj[100100];
 
stack<int> S;
 
int cnt = 0;
int dfn[100100], low[100100];
bool in_stack[100100];
int time_in = 0;
int kingdom[100100];

int self_e[100100];

void init(int n, int k){
    N = n;
    K = k;
    for (int i = 0; i < k-1; i++){
        adj[i].push_back(i+1);
    }
}

void dfs(int node){
    dfn[node] = ++time_in;
    low[node] = dfn[node];
    S.push(node);
    in_stack[node] = true;
    for (int nx : adj[node]){
        if (!dfn[nx]){
            dfs(nx);
            low[node] = min(low[node], low[nx]);
        } else if (in_stack[nx]){
            low[node] = min(low[node], dfn[nx]);
        }
    }
    if (low[node] == dfn[node]){
        ++cnt;
        while (S.top() != node){
            kingdom[S.top()] = cnt;
            in_stack[S.top()] = false;
            S.pop();
        }
        kingdom[S.top()] = cnt;
        in_stack[S.top()] = false;
        S.pop();
    }
}

int kcnt[100100];

bool good = false;

int add_teleporter(int u, int v){
    if (good) return true;
    if (u == v){
        self_e[u]++;
    }
    adj[u].push_back(v);
    cnt = 0;
    for (int i = 0; i < K; i++){
        kcnt[i] = kingdom[i] = 0;
    }
    while (!S.empty()){
        in_stack[S.top()] = false;
        S.pop();
    }
    for (int i = 0; i < K; i++){
        if (!dfn[i]){
            dfs(i);
        }
    }
    /*for (int i = 0; i < N; i++){
        cout << kingdom[i] << " ";
    }
    cout << "\n";*/
    for (int i = 0; i < K; i++){
        kcnt[kingdom[i]]++;
    }
    bool work = false;
    for (int i = 0; i < K; i++){
        if (kcnt[kingdom[i]] > 1 || self_e[i]){
            work = true;
            good = true;
        }
    }
    return work;
}

詳細信息

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:3:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~