#include <bits/stdc++.h>
using namespace std;
int min1(int a,int b)
{
if (a<b)
{
return a;
}
return b;
}
int max1(int a,int b)
{
if (a>b)
{
return a;
}
return b;
}
int n,m,i,j,st,dr,k,val2,val[5005],maxi[5005][5005],mini[5005][5005];
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n>>m;
for (i=1;i<=n;i++)
{
for (j=i+1;j<=n;j++)
{
maxi[i][j]=j-i+1;
}
}
for (i=1;i<=m;i++)
{
cin>>st>>dr>>k>>val2;
st++;
dr++;
if (val2==1)
{
maxi[st][dr]=min1(maxi[st][dr],k-1);
}
else
{
mini[st][dr]=max1(mini[st][dr],k);
}
}
for (i=1;i<=n;i++)
{
for (j=i+1;j<=n;j++)
{
if (mini[i][j]>maxi[i][j])
{
cout<<"-1";
return 0;
}
}
}
for (i=1;i<=n;i++)
{
val[i]=-1;
}
for (i=1;i<=n;i++)
{
for (j=i+1;j<=n;j++)
{
if (mini[i][j]==maxi[i][j]&&mini[i][j]==0)
{
for (k=i;k<=j;k++)
{
if (val[k]==1)
{
cout<<"-1";
return 0;
}
val[k]=0;
}
}
else
if (mini[i][j]==maxi[i][j]&&mini[i][j]==j-i+1)
{
for (k=i;k<=j;k++)
{
if (val[k]==0)
{
cout<<"-1";
return 0;
}
val[k]=1;
}
}
}
}
for (i=1;i<=n;i++)
{
if (val[k]==-1)
{
cout<<"1";
}
else
{
cout<<1-val[k];
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Integer 11111111 violates the range [-1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
94136 KB |
Expected integer, but "111111111111111111111111111111...1111111111111111111111111111111" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
94136 KB |
Expected integer, but "111111111111111111111111111111...1111111111111111111111111111111" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Integer 11111111 violates the range [-1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |