QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527692#6659. 외곽 순환 도로 2NianFengCompile Error//C++201.5kb2024-08-22 18:17:382024-08-22 18:17:38

Judging History

你现在查看的是测评时间为 2024-08-22 18:17:38 的历史记录

  • [2024-08-26 15:53:43]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:104ms
  • 内存:29416kb
  • [2024-08-22 18:17:38]
  • 评测
  • [2024-08-22 18:17:38]
  • 提交

answer

#include<bits/stdc++.h>
#define fr(i,j,k) for(int i=j;i<=k;++i)
#define mk make_pair
#define pil pair<int,long long>
#define ll long long
#define pb push_back
using namespace std;
const int Maxn=1e5+10;
const ll inf=1e18;
vector<pil> vc[Maxn];
ll f[Maxn][2][2][2];
ll val[Maxn],g[2][2][2];
int n,siz[Maxn];
int num;
inline void chkmin(ll &x,ll y){if(x>y) x=y;}
inline void dfs(int x){
    cerr<<x<<endl;
    if(vc[x].empty()){siz[x]=1;++num;f[x][1][1][1]=f[x][0][0][0]=0;return;}
    int chs=0;
    ll now;
    for(auto p:vc[x]){
        int y=p.first;ll z=p.second;dfs(y);
        fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) g[i1][i2][i3]=f[x][i1][i2][i3],f[x][i1][i2][i3]=inf;
        if(!chs){
            fr(rt,0,1) fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) chkmin(f[x][rt][i2][i3],f[y][i1][i2][i3]+(rt==i1)*z);
            ++chs;
        }
        else {
            fr(i1,0,1) fr(i2,0,1) fr(i3,0,1)
            fr(j1,0,1) fr(j2,0,1) fr(j3,0,1){
                chkmin(f[x][i1][i2][j3],g[i1][i2][i3]+f[y][j1][j2][j3]+(i1==j1)*z+(i3==j2)*now);
            }
        }now=val[num];
    }
}
long long place_police(vector<int> P, vector<long long> C, vector<long long> W){
    n=P.size()+1;// cerr<<n<<endl;
    fr(i,2,n){
        // cerr<<P[i-2]+1<<' '<<i<<endl;
        vc[P[i-2]+1].pb(mk(i,C[i-2]));
    }
    fr(i,1,n) fr(j1,0,1) fr(j2,0,1) fr(j3,0,1) f[i][j1][j2][j3]=inf;
    for(auto x:W) val[++num]=x;num=0;
    dfs(1);
    ll ans=inf;
    fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) chkmin(ans,f[1][i1][i2][i3]+(i2==i3)*val[num]);
    return ans;
}

Details

cc1plus: fatal error: implementer.cpp: No such file or directory
compilation terminated.