Submission #1097758

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10977582024-10-08 08:09:55vjudge1The Xana coup (BOI21_xanadu)C++17
100 / 100
34 ms17812 KiB
#include<iostream>
#include<cstdio>
#include<bitset>
using namespace std;
const int N=1e5+10,inf=0x3f3f3f3f;
int cnt,hd[N],to[N<<1],nxt[N<<1];
void add(int u,int v){
++cnt;
to[cnt]=v;
nxt[cnt]=hd[u];
hd[u]=cnt;
}
bitset<N>aa,used;
int f[N][2][2],g[N][2][2];
void dfs(int p){
bool ju=1;
int pre=0;
used[p]=1;
for(int i=hd[p];i;i=nxt[i]){
if(used[to[i]])continue;
ju=0;
dfs(to[i]);
g[to[i]][0][0]=min(min(g[pre][0][0]+f[to[i]][0][0],inf),min(g[pre][0][1]+f[to[i]][1][0],inf));
g[to[i]][0][1]=min(min(g[pre][0][1]+f[to[i]][0][0],inf),min(g[pre][0][0]+f[to[i]][1][0],inf));
g[to[i]][1][0]=min(min(g[pre][1][0]+f[to[i]][0][1],inf),min(g[pre][1][1]+f[to[i]][1][1],inf));
g[to[i]][1][1]=min(min(g[pre][1][1]+f[to[i]][0][1],inf),min(g[pre][1][0]+f[to[i]][1][1],inf));
pre=to[i];
}
if(ju){
f[p][0][0]=(aa[p]?inf:0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

xanadu.cpp: In function 'int main()':
xanadu.cpp:43:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
xanadu.cpp:45:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   scanf("%d%d",&u,&v);
      |   ~~~~~^~~~~~~~~~~~~~
xanadu.cpp:51:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   scanf("%d",&oo);
      |   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...