QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#56246#1972. JJ RallyAmrMohameDCompile Error//C++2.6kb2022-10-18 07:33:412022-10-18 07:33:42

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-18 07:33:42]
  • 评测
  • [2022-10-18 07:33:41]
  • 提交

answer

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

#define EPS 1e-9
#define PI acos(-1.0)
#define ll long long
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define pb push_back
#define ft first
#define sc second
#define pi pair<int,int>
#define vi vector<int>
#define sz(s) s.size()
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll N = 25, M = (1 << 24), MOD = (1LL<<32), INF = 1e18;
int dx[] = {-1, 1, 0, 0}, Dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};;
int dy[] = {0, 0, 1, -1}, Dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
int n, m, t,dp[20][M],dp2[20][M], s1,s2,t1,t2,dis[N][N];
vector<pi> g[25];
int solve2(int node,int msk)
{
  //  cout << node << ' ' << msk << endl;
    if(t2 == node){
       // cout << msk << endl;
        return 1;
    }
    int &ret = dp2[node][msk];
    if(~ret)
        return ret;
    ret = 0;
    for(auto it:g[node])
    {
        if(dis[s2][node] + it.sc + dis[it.ft][t2] == dis[s2][t2] && !(msk&(1<<it.ft)))
            ret += solve2(it.ft,msk|(1<<it.ft));
    }
    return ret;
}
int solve(int node,int msk)
{
    if(t1 == node){
        return solve2(s2,msk|(1<<s2));
    }
    int &ret = dp[node][msk];
    if(~ret)
        return ret;
    ret = 0;
    for(auto it:g[node])
    {
        if(it.ft != s2 && it.ft != t2 && dis[s1][node] + it.sc + dis[it.ft][t1] == dis[s1][t1])
            ret += solve(it.ft,msk|(1<<it.ft));
    }
    return ret;
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);//freopen("lines.in", "r", stdin);
    cin >> n >> m;
    for(int i = 0; i < n ;++i)
    {
        dis[i][i] = 0;
        for(int j = i+1; j < n ;++j)
        {
            dis[i][j] = dis[j][i] = 1e9;
        }
    }
    for(int i = 0; i < m ;++i)
    {
        int u,v,c;
        cin >> u >> v >> c;
        u--,v--;
        dis[u][v] = dis[v][u] = c;
        g[u].pb({v,c});
        g[v].pb({u,c});
    }
    cin >> s1 >> t1 >> s2 >> t2;
    s1--,s2--,t1--,t2--;
    memset(dp,-1,sizeof dp);
    memset(dp2,-1,sizeof dp2);
    for(int i = 0; i < n ;++i)
    {
        for(int j = 0;j < n ;++j)
        {
            for(int k = 0; k < n ;++k)
            {
                dis[i][j] = min(dis[i][j] , dis[i][k] + dis[k][j]);
            }
        }
    }
    cout << solve(s1,(1<<s1) | (1<<t1));
    return 0;
}
/*
*/

Details

/tmp/ccERoqPi.o: In function `main':
answer.code:(.text.startup+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x57): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x66): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x378): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x498): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x542): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccERoqPi.o
answer.code:(.text.startup+0x9de): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccERoqPi.o
/tmp/ccERoqPi.o: In function `_GLOBAL__sub_I_dx':
answer.code:(.text.startup+0xa2d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status