제출 #199450

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1994502020-02-01 12:51:03TadijaSebezPipes (BOI13_pipes)C++11
93.52 / 100
1065 ms80608 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=100050;
const int M=500050;
int deg[N];
ll c[N],ans[M];
vector<pair<int,int>> E[N];
bool was[N],vis[N],cyc[N];
int dep[N],mnd[N],par[N];
void No(){printf("0\n");exit(0);}
void DFS(int u,int p=0){
vis[u]=1;
for(auto e:E[u]){
int v=e.first;
if(!vis[v]){
dep[v]=dep[u]+1;
par[v]=u;
DFS(v,u);
}else if(dep[v]<dep[u] && v!=p){
//printf("%i %i %i\n",dep[u]-dep[v],u,v);
if((dep[u]-dep[v])%2==1)No();
for(int w=u;w!=v;w=par[w]){
if(cyc[w])No();
cyc[w]=1;
}
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

pipes.cpp: In function 'int main()':
pipes.cpp:80:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<cycle.size();i++)if(cycle[i]==v)j=i;
               ~^~~~~~~~~~~~~
pipes.cpp:81:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<cycle.size();i++){
               ~^~~~~~~~~~~~~
pipes.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
pipes.cpp:34:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++)scanf("%lld",&c[i]);
                       ~~~~~^~~~~~~~~~~~~~
pipes.cpp:36:95: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1,u,v;i<=m;i++)scanf("%i %i",&u,&v),E[u].pb({v,i}),E[v].pb({u,i}),deg[u]++,deg[v]++,idx[{u,v}]=idx[{v,u}]=i;
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
pipes.cpp:79:7: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int j;
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...