# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
284315 |
2020-08-27T08:29:14 Z |
최은수(#5747) |
Arcade (NOI20_arcade) |
C++17 |
|
0 ms |
0 KB |
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
inline bool chk(const pi&x,const pi&y)
{
return abs(x.fi-y.fi)>=abs(x.se-y.se);
}
bool dp2[105][105];
bool dp[105][105][105];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,m;
cin>>n>>m;
vector<pi>v(m);
for(pi&t:v)
cin>>t.fi;
for(pi&t:v)
cin>>t.se;
sort(all(v));
bool f=1;
for(int i=1;i<n;i++)
if(!chk(v[i-1],v[i]))
f=0;
if(f)
return cout<<1<<endl,0;
dp2[1][0]=1;
for(int i=1;i<n;i++)
{
if(!chk(v[i-1],v[i]))
break;
dp2[i+1][i]=1;
}
for(int i=2;i<n;i++)
{
for(int j=0;j<i-1;j++)
{
if(!dp2[i-1][j])
continue;
if(chk(v[i],v[i-1]))
dp2[i][j]=1;
if(chk(v[i],v[j]))
dp2[i][i-1]=1;
}
}
bool f=0;
for(int i=0;i<n-1;i++)
if(dp2[n-1][i])
f=1;
if(f)
return cout<<2<<endl,0;
cout<<3<<endl;
return 0;
}
Compilation message
Arcade.cpp: In function 'int main()':
Arcade.cpp:58:10: error: redeclaration of 'bool f'
58 | bool f=0;
| ^
Arcade.cpp:33:10: note: 'bool f' previously declared here
33 | bool f=1;
| ^