QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116057 | #6659. 외곽 순환 도로 2 | csy2005# | Compile Error | / | / | C++14 | 2.7kb | 2023-06-28 08:34:20 | 2024-05-31 14:20:05 |
Judging History
你现在查看的是测评时间为 2024-05-31 14:20:05 的历史记录
- [2024-05-31 14:20:05]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-28 08:34:20]
- 提交
answer
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<bitset>
#include<cassert>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(((long long)(n))-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();++itr)
#define pb push_back
#define mk make_pair
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define spln(i,n) (i==n?'\n':' ')
#define fac_init(n){fac[0]=fac[1]=inv[1]=fi[0]=fi[1]=1;fz(i,2,n){fac[i]=1ll*fac[i-1]*i%mod;inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;fi[i]=1ll*fi[i-1]*inv[i]%mod;}}
using namespace std;
typedef long long i64;
typedef long double f80;
typedef unsigned int u32;
typedef unsigned long long u64;
//typedef __int128 i128;
//typedef unsigned __int128 u128;
#ifndef ONLINE_JUDGE
FILE *___=freopen("1.in","r",stdin);
#endif
inline void read(int &x)
{
char c;int f=1;
while(!isdigit(c=getchar()))if(c=='-')f=-1;
x=(c&15);while(isdigit(c=getchar()))x=(x<<1)+(x<<3)+(c&15);
x*=f;
}
int n,m,i,j,k;
i64 h[100005],f[100005][2][2][2],nf[2][2][2];
vector<pair<int,i64> > bi[100005];
vector<i64> w;int ptr;
void dfs1(int x)
{
ff(bi[x],it){
dfs1(it->first);
if(next(it)!=bi[x].end()) h[it->first]=w[ptr++];
else h[it->first]=-2;
}
}
void dfs2(int x)
{
memset(f[x],0x3f,sizeof(f[x]));i64 lst=-1;
int i,j,k,ni,nj,nk;
ff(bi[x],it){
int y=it->first;i64 e=it->second;dfs2(y);
if(lst==-1){
fz0k(i,2)fz0k(ni,2)fz0k(nj,2)fz0k(nk,2){
f[x][i][nj][nk]=min(f[x][i][nj][nk],f[y][ni][nj][nk]+(i==ni?e:0));
}
}
else{
memset(nf,0x3f,sizeof(nf));
fz0k(i,2)fz0k(j,2)fz0k(k,2)fz0k(ni,2)fz0k(nj,2)fz0k(nk,2){
nf[i][j][nk]=min(nf[i][j][nk],f[x][i][j][k]+f[y][ni][nj][nk]+(i==ni?e:0)+(k==nj?lst:0));
}
memcpy(f[x],nf,sizeof(nf));
}
lst=h[y];
}
if(lst==-1) f[x][0][0][0]=f[x][1][1][1]=0;
}
long long place_police(vector<int> P,vector<long long> C,vector<long long> W)
{
n=P.size();fz1(i,n)bi[P[i-1]].push_back(make_pair(i,C[i-1]));
w=W;ptr=0;dfs1(0);dfs2(0);
i64 ans=0x3f3f3f3f3f3f3f3fll;
fz0k(i,2)fz0k(j,2)fz0k(k,2)ans=min(ans,f[0][i][j][k]+(j==k?w.back():0));
return ans;
}
Details
cc1plus: fatal error: implementer.cpp: No such file or directory compilation terminated.