제출 #399213

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3992132021-05-05 12:27:59keta_tsimakuridzeElection Campaign (JOI15_election_campaign)C++14
100 / 100
429 ms43196 KiB
#include<bits/stdc++.h>
#define f first
#define int long long
#define s second
using namespace std;
const int N=1e5+5,mod=1e9+7;
int t,tmin[N],tmout[N],tree[4*N],g[2],timer,dp[N][2],n,m,ans,par[N][20],Lg;
vector<int>V[N];
vector<pair<int,pair<int,int> > >q[N];
string s;
void dfs(int u,int p) {
timer++;
tmin[u]=timer;
par[u][0]=p;
for(int i=1;i<=Lg;i++) par[u][i]=par[par[u][i-1]][i-1];
for(int i=0;i<V[u].size();i++){
if(V[u][i]==p) continue;
dfs(V[u][i],u);
}
tmout[u]=timer;
}
bool check(int u,int v){
if(tmin[u]<=tmin[v] && tmout[u]>=tmout[v]) return 1;
return 0;
}
int find_lca(int u,int v){
if(check(u,v)) return u;
if(check(v,u)) return v;
for(int i=Lg;i>=0;i--){
if(par[u][i] && !check(par[u][i],v)) u=par[u][i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

election_campaign.cpp: In function 'void dfs(long long int, long long int)':
election_campaign.cpp:16:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
election_campaign.cpp: In function 'void solve(long long int, long long int)':
election_campaign.cpp:59:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
election_campaign.cpp:65:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for(int i=0;i<q[u].size();i++){
      |              ~^~~~~~~~~~~~
election_campaign.cpp:77:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
election_campaign.cpp: At global scope:
election_campaign.cpp:83:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   83 |  main(){
      |       ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...