QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#527662 | #6659. 외곽 순환 도로 2 | NianFeng | Compile Error | / | / | C++20 | 2.6kb | 2024-08-22 18:05:12 | 2024-08-22 18:05:12 |
Judging History
你现在查看的是测评时间为 2024-08-22 18:05:12 的历史记录
- [2024-08-22 18:05:12]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-08-22 18:05:12]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 1e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
ll n,m=0,head[100010],cnt=0,L[100010],R[100010],w[100010],f[100010][2][2][2];
struct node{
ll nxt,to,w;
}e[100010];
void add(ll u,ll v,ll ww){
e[++cnt].nxt=head[u];
e[cnt].to=v;
e[cnt].w=ww;
head[u]=cnt;
}
void dfs(ll u){
go(u){
ll v=e[i].to;
dfs(v);
if(!L[u]) L[u]=L[v];
R[u]=R[v];
}
if(!L[u]) L[u]=R[u]=++m;
}
void dfss(ll u){
fr(x,0,1) fr(y,0,1) fr(z,0,1) f[u][x][y][z]=inf;
go(u){
ll v=e[i].to;
dfss(v);
}
if(!head[u]){
f[u][0][0][0]=f[u][1][1][1]=0;
return;
}
ll lst[2][2];
fr(col,0,1){
go(u){
ll v=e[i].to;
fr(x,0,1) fr(y,0,1) lst[x][y]=f[u][col][x][y];
fr(x,0,1) fr(y,0,1) f[u][col][x][y]=inf;
if(i==head[u]){
fr(vcol,0,1) fr(x,0,1) fr(y,0,1) f[u][col][x][y]=min(f[u][col][x][y],f[v][vcol][x][y]+(col==vcol)*e[i].w);
continue;
}
fr(x,0,1) fr(y,0,1) fr(vcol,0,1) fr(xx,0,1) fr(yy,0,1) f[u][col][x][yy]=min(f[u][col][x][yy],lst[x][y]+f[v][vcol][xx][yy]+(y==xx)*w[L[v]-1]+(vcol==col)*e[i].w);
}
}
}
ll place_police(vector<int> P,vector<ll> C,vector<ll> W){
n=P.size()+1;
pfr(i,n,2) add(P[i-2]+1,i,C[i-2]);
dfs(1);
fr(i,1,m) w[i]=W[i-1];
dfss(1);
ll ans=inf;
fr(col,0,1) fr(x,0,1) fr(y,0,1) ans=min(ans,f[1][col][x][y]+(x==y)*w[m]);
return ans;
}
/*
妙妙题
删成没有奇环很难刻画,考虑没有奇环就是二分图,可以黑白染色。
*/
详细
cc1plus: fatal error: implementer.cpp: No such file or directory compilation terminated. answer.code: In function ‘void dfss(long long int)’: answer.code:92:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 92 | fr(x,0,1) fr(y,0,1) fr(z,0,1) f[u][x][y][z]=inf; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:92:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 92 | fr(x,0,1) fr(y,0,1) fr(z,0,1) f[u][x][y][z]=inf; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:92:32: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 92 | fr(x,0,1) fr(y,0,1) fr(z,0,1) f[u][x][y][z]=inf; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:102:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 102 | fr(col,0,1){ | ^~~ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:105:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 105 | fr(x,0,1) fr(y,0,1) lst[x][y]=f[u][col][x][y]; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:105:38: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 105 | fr(x,0,1) fr(y,0,1) lst[x][y]=f[u][col][x][y]; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:106:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 106 | fr(x,0,1) fr(y,0,1) f[u][col][x][y]=inf; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:106:38: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 106 | fr(x,0,1) fr(y,0,1) f[u][col][x][y]=inf; | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:108:36: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 108 | fr(vcol,0,1) fr(x,0,1) fr(y,0,1) f[u][col][x][y]=min(f[u][col][x][y],f[v][vcol][x][y]+(col==vcol)*e[i].w); | ^~~~ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:108:49: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 108 | fr(vcol,0,1) fr(x,0,1) fr(y,0,1) f[u][col][x][y]=min(f[u][col][x][y],f[v][vcol][x][y]+(col==vcol)*e[i].w); | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:108:59: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 108 | fr(vcol,0,1) fr(x,0,1) fr(y,0,1) f[u][col][x][y]=min(f[u][col][x][y],f[v][vcol][x][y]+(col==vcol)*e[i].w); | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define fr(i,x,y) for(register ll i=(x);i<=(y);i++) | ^ answer.code:111:28: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 111 | fr(x,0,1) fr(y,0,1) fr(vcol,0,1) fr(xx,0,1) fr(yy,0,1) f[u][col][x][yy]=min(f[u][col][x][yy],lst[x][y]+f[v][vcol][xx][yy]+(y==xx)*w[L[v]-1]+(vcol==col)*e[i].w); | ^ answer.code:29:43: note: in definition of macro ‘fr’ 29 | #define ...