Submission #332921

# Submission time Handle Problem Language Result Execution time Memory
332921 2020-12-04T02:02:15 Z YJU Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "Joi.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int  ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()

ll d[N],col[N],ti,tag[N];
vector<ll> lis;

ll f(ll id){return (id==d[id]?id:d[id]=f(d[id]));}

void DFS(ll nd,ll pa){
	tag[nd]=ti++;lis.pb(nd);
	for(auto i:v[nd]){
		if(i==pa)continue;
		DFS(i,nd);
	}
	lis.pb(nd);
}

void Joi(ll n,ll m,vector<ll> A,vector<ll> B,ll x,ll T){
	REP(i,n)d[i]=i;
	REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
	REP(i,n)sort(v[i].begin(),v[i].end());
	DFS(0,-1);
	REP(i,n)MessageBoard(i,col[i]=(x>>(tag[i]%60))&1);
}
#include<bits/stdc++.h>
#include"Ioi.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=4e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()


ll d[N],col[N],ti,ans[N],tag[N];
vector<ll> lis,res;

ll f(ll id){return (id==d[id]?id:d[id]=f(d[id]));}

void DFS(ll nd,ll pa){
	tag[nd]=ti++;lis.pb(nd);
	for(auto i:v[nd]){
		if(i==pa)continue;
		DFS(i,nd);
	}
	lis.pb(nd);
}

long long Ioi(ll n,ll m,vector<ll> A,vector<ll> B,ll P,ll V,ll T){
	REP(i,n)d[i]=i;
	REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
	REP(i,n)sort(v[i].begin(),v[i].end());
	DFS(0,-1);
	ans[P]=V;res.pb(P);
	lis.resize(unique(lis.begin(),lis.end())-lis.begin());
	if(tag[P]+1>=60){
		for(int i=tag[P]-1;i>=0;i--){
			ans[lis[i]]=move(i);
			res.pb(lis[i]);
		}
	}else{
		for(int i=tag[P]+1;i<SZ(lis);i++){
			ans[lis[i]]=move(i);
			res.pb(lis[i]);
		}
	}
	ll x=0;
	for(auto i:res){
		if(ans[i])x|=(1LL<<(tag[i]%60));
	}
	return x;
}

Compilation message

Joi.cpp:13:18: warning: overflow in conversion from 'long long int' to 'll' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
   13 | const ll INF=(1LL<<60);
      |              ~~~~^~~~~
Joi.cpp: In function 'void DFS(ll, ll)':
Joi.cpp:32:13: error: 'v' was not declared in this scope
   32 |  for(auto i:v[nd]){
      |             ^
Joi.cpp: In function 'void Joi(ll, ll, std::vector<int>, std::vector<int>, ll, ll)':
Joi.cpp:41:44: error: 'v' was not declared in this scope
   41 |  REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
      |                                            ^
Joi.cpp:42:15: error: 'v' was not declared in this scope
   42 |  REP(i,n)sort(v[i].begin(),v[i].end());
      |               ^

Ioi.cpp: In function 'void DFS(ll, ll)':
Ioi.cpp:33:13: error: 'v' was not declared in this scope
   33 |  for(auto i:v[nd]){
      |             ^
Ioi.cpp: In function 'long long int Ioi(ll, ll, std::vector<long long int>, std::vector<long long int>, ll, ll, ll)':
Ioi.cpp:42:44: error: 'v' was not declared in this scope
   42 |  REP(i,m)if(f(A[i])==f(B[i]))continue;else v[A[i]].pb(B[i]),v[B[i]].pb(A[i]),d[f(A[i])]=f(B[i]);
      |                                            ^
Ioi.cpp:43:15: error: 'v' was not declared in this scope
   43 |  REP(i,n)sort(v[i].begin(),v[i].end());
      |               ^