Submission #63069

# Submission time Handle Problem Language Result Execution time Memory
63069 2018-07-31T15:51:39 Z zetapi Paths (BOI18_paths) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define pb  push_back
#define mp  make_pair
#define int long long
#define itr ::iterator 

typedef pair<int,int>  pii;

const int MAX=1e6;

pii edge[MAX];

ll N,M,K,res,arr[MAX],dp[MAX][40];

signed main()
{
	ios_base::sync_with_stdio(false);
	
	cin>>N>>M>>K;
	for(int A=0;A<N;A++)
	{
		cin>>arr[A];
		arr[A]--;
	}
	for(int A=0;A<M;A++)
	{
		cin>>edge[A].first>>edge[A].second;
		edge[A].first--;
		edge[A].second--;
	}
	for(int A=0;A<N;A++)
		dp[A][(1<<arr[A])]=1;
	for(int A=2;A<=K;A++)
	{
		int u,v;
		for(int B=0;B<M;B++)
		{
			u=edge[B].first;
			v=edge[B].second;
			for(int C=0;C<(1<<K);C++)
			{
				if(((C&(1<<arr[v]))!=0) or __builtin_popcount(C)!=A-1)
					continue;
				dp[v][C|(1<<arr[v])]+=dp[u][C];
			}
			for(int C=0;C<(1<<K);C++)
			{
				if(((C&(1<<arr[u]))!=0) or __builtin_popcount(C)!=A-1)
					continue;
				dp[u][C|(1<<arr[u])]+=dp[v][C];
			}
		}

	}
	for(int A=0;A<N;A++)
		for(int B=0;B<(1<<K);B++)
			res+=dp[A][B];
	cout<<res-N;
	return 0;
}

Compilation message

paths.cpp:15:1: error: 'll' does not name a type
 ll N,M,K,res,arr[MAX],dp[MAX][40];
 ^~
paths.cpp: In function 'int main()':
paths.cpp:21:7: error: 'N' was not declared in this scope
  cin>>N>>M>>K;
       ^
paths.cpp:21:10: error: 'M' was not declared in this scope
  cin>>N>>M>>K;
          ^
paths.cpp:21:13: error: 'K' was not declared in this scope
  cin>>N>>M>>K;
             ^
paths.cpp:24:8: error: 'arr' was not declared in this scope
   cin>>arr[A];
        ^~~
paths.cpp:34:3: error: 'dp' was not declared in this scope
   dp[A][(1<<arr[A])]=1;
   ^~
paths.cpp:34:3: note: suggested alternative: 'mp'
   dp[A][(1<<arr[A])]=1;
   ^~
   mp
paths.cpp:34:13: error: 'arr' was not declared in this scope
   dp[A][(1<<arr[A])]=1;
             ^~~
paths.cpp:44:16: error: 'arr' was not declared in this scope
     if(((C&(1<<arr[v]))!=0) or __builtin_popcount(C)!=A-1)
                ^~~
paths.cpp:46:5: error: 'dp' was not declared in this scope
     dp[v][C|(1<<arr[v])]+=dp[u][C];
     ^~
paths.cpp:46:5: note: suggested alternative: 'mp'
     dp[v][C|(1<<arr[v])]+=dp[u][C];
     ^~
     mp
paths.cpp:46:17: error: 'arr' was not declared in this scope
     dp[v][C|(1<<arr[v])]+=dp[u][C];
                 ^~~
paths.cpp:50:16: error: 'arr' was not declared in this scope
     if(((C&(1<<arr[u]))!=0) or __builtin_popcount(C)!=A-1)
                ^~~
paths.cpp:52:5: error: 'dp' was not declared in this scope
     dp[u][C|(1<<arr[u])]+=dp[v][C];
     ^~
paths.cpp:52:5: note: suggested alternative: 'mp'
     dp[u][C|(1<<arr[u])]+=dp[v][C];
     ^~
     mp
paths.cpp:52:17: error: 'arr' was not declared in this scope
     dp[u][C|(1<<arr[u])]+=dp[v][C];
                 ^~~
paths.cpp:59:4: error: 'res' was not declared in this scope
    res+=dp[A][B];
    ^~~
paths.cpp:59:9: error: 'dp' was not declared in this scope
    res+=dp[A][B];
         ^~
paths.cpp:59:9: note: suggested alternative: 'mp'
    res+=dp[A][B];
         ^~
         mp
paths.cpp:60:8: error: 'res' was not declared in this scope
  cout<<res-N;
        ^~~