답안 #396035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
396035 2021-04-29T11:45:59 Z nathanlee726 항공 노선도 (JOI18_airline) C++14
컴파일 오류
0 ms 0 KB
//#include<i_am_noob_orz>
#include<bits/stdc++.h>
#include<Alicelib.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define int ll
#define ull unsigned long long
#define pii pair<int,int>
#define X first
#define Y second
#define mod ((ll)1e9+7)
#define pb push_back
#define mp make_pair
#define abs(x) ((x)>0?(x):(-(x)))
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define memres(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
#define sz(a) ((int)a.size())
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define endl '\n'
#define bit_count(x) __builtin_popcountll((x))
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define jimmy_is_kind false
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
 
//#define LOCAL
#ifdef LOCAL
#define bug(...) cerr<<"#"<<__LINE__<<' '<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y) {cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define bug(...)
#endif
 
int add(int a,int b){return(a+b>=mod?a+b-mod:a+b);}
int sub(int a,int b){return(a<b?a+mod-b:a-b);}
int po(int a,int b){
	if(b==0)return 1;
	if(b==1)return(a%mod);
	int tem=po(a,b/2);
	if(b&1)return(((tem*tem)%mod)*a)%mod;
	else return(tem*tem)%mod; 
}
int GCD(int a,int b){
	int x=0;
	int ra,rb;
	while(a&&b){
		if(((a&1)==0)&&((b&1)==0)){
			a>>=1,b>>=1,x++;
		}
		else if((a^b)&1){
			if(a&1)b>>=1;
			else a>>=1;
		}
		else{
			ra=abs(a-b),rb=min(a,b);
			a=ra,b=rb;
		}
	}
	return max(a,b)<<x;
}
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int n,m,c[500010],d[500010];
void Alice(int N,int M,int A[],int B[]){
	int n=N+12,m=0;
	F(n){
		Fi(j,10)if((i+1)&(1<<j)){c[m]=n+j+1,d[m]=i,m++;}
		}
	}
	InitG(n,M+m+11);
	F(M)MakeG(a[i],b[i]);
	F(m)MakeG(c[i],d[i]);
	F(11)MakeG(n+i,n+i+1);
}
signed main(){
	IOS();
	
	return 0;
}
//#include<i_am_noob_orz>
#include<bits/stdc++.h>
#include<Boblib.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define int ll
#define ull unsigned long long
#define pii pair<int,int>
#define X first
#define Y second
#define mod ((ll)1e9+7)
#define pb push_back
#define mp make_pair
#define abs(x) ((x)>0?(x):(-(x)))
#define F(n) Fi(i,n)
#define Fi(i,n) Fl(i,0,n)
#define Fl(i,l,n) for(int i=l;i<n;i++)
#define memres(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
#define sz(a) ((int)a.size())
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define endl '\n'
#define bit_count(x) __builtin_popcountll((x))
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define jimmy_is_kind false
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
 
//#define LOCAL
#ifdef LOCAL
#define bug(...) cerr<<"#"<<__LINE__<<' '<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__)
template<typename T> void _do(T && x) {cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S&&...y) {cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define bug(...)
#endif
 
int add(int a,int b){return(a+b>=mod?a+b-mod:a+b);}
int sub(int a,int b){return(a<b?a+mod-b:a-b);}
int po(int a,int b){
	if(b==0)return 1;
	if(b==1)return(a%mod);
	int tem=po(a,b/2);
	if(b&1)return(((tem*tem)%mod)*a)%mod;
	else return(tem*tem)%mod; 
}
int GCD(int a,int b){
	int x=0;
	int ra,rb;
	while(a&&b){
		if(((a&1)==0)&&((b&1)==0)){
			a>>=1,b>>=1,x++;
		}
		else if((a^b)&1){
			if(a&1)b>>=1;
			else a>>=1;
		}
		else{
			ra=abs(a-b),rb=min(a,b);
			a=ra,b=rb;
		}
	}
	return max(a,b)<<x;
}
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
vector<int> g[1050];
int fr[1050],id[1050],idd[1050],c[500010],d[500010];
bool vis[1050],tag[1050];
void Bob(int N,int M,int a[],int b[]){
	int n=N-12,m=0;
	vector<int> v;
	F(M){
		g[a[i]].pb(b[i]);
	}
	F(N)if(sz(g[i])==1)v.pb(i);
	memres(tag);
	int s=v[0],t=v[i];
	tag[s]=1,tag[t]=1;
	s=g[s][0],t=g[t][0];
	if(sz(s)<sz(t))swap(s,t);
	memres(vis);
	priority_queue<pii,vector<pii>,greater<pii> >pq; 
	vis[s]=1;
	pq.push({0,s});
	while(!pq.empty()){
		int p=pq.top();pq.pop();
		for(int u:g[p.Y]){
			if(vis[u])continue;
			fr[u]=p;
			pq.push({p.X+1,u});
			vis[u]=1;
		}
	}
	F(10){tag[t]=1;id[t]=9-i;t=fr[t];}
	F(N){
		if(tag[i])continue;
		int ind=0;
		for(int u:g[i]){
			if(tag[u]){
				ind+=id[u];
			}
		}
		idd[i]=ind;	
	}
	F(N){
		if(tag[i])continue;
		for(int u:g[i]){
			if(tag[u])continue;
			if(i<u){
				c[m]=idd[i];
				d[m]=idd[u];
				m++;
			}
		}
	}
	InitMap(n,m);
	F(m){
		MakeMap(c[i],d[i]);
	}
}
signed main(){
	IOS();
	
	return 0;
}

Compilation message

Alice.cpp:78:7: error: expected constructor, destructor, or type conversion before '(' token
   78 |  InitG(n,M+m+11);
      |       ^
Alice.cpp:20:19: error: expected unqualified-id before 'for'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                   ^~~
Alice.cpp:19:17: note: in expansion of macro 'Fl'
   19 | #define Fi(i,n) Fl(i,0,n)
      |                 ^~
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:79:2: note: in expansion of macro 'F'
   79 |  F(M)MakeG(a[i],b[i]);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:31: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                               ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:79:2: note: in expansion of macro 'F'
   79 |  F(M)MakeG(a[i],b[i]);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:35: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                                   ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:79:2: note: in expansion of macro 'F'
   79 |  F(M)MakeG(a[i],b[i]);
      |  ^
Alice.cpp:20:19: error: expected unqualified-id before 'for'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                   ^~~
Alice.cpp:19:17: note: in expansion of macro 'Fl'
   19 | #define Fi(i,n) Fl(i,0,n)
      |                 ^~
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:80:2: note: in expansion of macro 'F'
   80 |  F(m)MakeG(c[i],d[i]);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:31: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                               ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:80:2: note: in expansion of macro 'F'
   80 |  F(m)MakeG(c[i],d[i]);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:35: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                                   ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:80:2: note: in expansion of macro 'F'
   80 |  F(m)MakeG(c[i],d[i]);
      |  ^
Alice.cpp:20:19: error: expected unqualified-id before 'for'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                   ^~~
Alice.cpp:19:17: note: in expansion of macro 'Fl'
   19 | #define Fi(i,n) Fl(i,0,n)
      |                 ^~
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:81:2: note: in expansion of macro 'F'
   81 |  F(11)MakeG(n+i,n+i+1);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:31: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                               ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:81:2: note: in expansion of macro 'F'
   81 |  F(11)MakeG(n+i,n+i+1);
      |  ^
Alice.cpp:18:17: error: 'i' does not name a type
   18 | #define F(n) Fi(i,n)
      |                 ^
Alice.cpp:20:35: note: in definition of macro 'Fl'
   20 | #define Fl(i,l,n) for(int i=l;i<n;i++)
      |                                   ^
Alice.cpp:18:14: note: in expansion of macro 'Fi'
   18 | #define F(n) Fi(i,n)
      |              ^~
Alice.cpp:81:2: note: in expansion of macro 'F'
   81 |  F(11)MakeG(n+i,n+i+1);
      |  ^
Alice.cpp:82:1: error: expected declaration before '}' token
   82 | }
      | ^

Bob.cpp: In function 'void Bob(long long int, long long int, long long int*, long long int*)':
Bob.cpp:82:17: error: 'i' was not declared in this scope
   82 |  int s=v[0],t=v[i];
      |                 ^
Bob.cpp:23:23: error: request for member 'size' in 's', which is of non-class type 'long long int'
   23 | #define sz(a) ((int)a.size())
      |                       ^~~~
Bob.cpp:85:5: note: in expansion of macro 'sz'
   85 |  if(sz(s)<sz(t))swap(s,t);
      |     ^~
Bob.cpp:23:23: error: request for member 'size' in 't', which is of non-class type 'long long int'
   23 | #define sz(a) ((int)a.size())
      |                       ^~~~
Bob.cpp:85:11: note: in expansion of macro 'sz'
   85 |  if(sz(s)<sz(t))swap(s,t);
      |           ^~
Bob.cpp:91:15: error: cannot convert 'const value_type' {aka 'const std::pair<long long int, long long int>'} to 'long long int' in initialization
   91 |   int p=pq.top();pq.pop();
      |         ~~~~~~^~
      |               |
      |               const value_type {aka const std::pair<long long int, long long int>}
Bob.cpp:13:11: error: request for member 'second' in 'p', which is of non-class type 'long long int'
   13 | #define Y second
      |           ^~~~~~
Bob.cpp:92:17: note: in expansion of macro 'Y'
   92 |   for(int u:g[p.Y]){
      |                 ^
Bob.cpp:12:11: error: request for member 'first' in 'p', which is of non-class type 'long long int'
   12 | #define X first
      |           ^~~~~
Bob.cpp:95:15: note: in expansion of macro 'X'
   95 |    pq.push({p.X+1,u});
      |               ^
Bob.cpp:95:21: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::push(<brace-enclosed initializer list>)'
   95 |    pq.push({p.X+1,u});
      |                     ^
In file included from /usr/include/c++/9/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from Bob.cpp:2:
/usr/include/c++/9/bits/stl_queue.h:627:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, long long int>]'
  627 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:627:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
  627 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:635:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, long long int>]'
  635 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:635:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  635 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~