This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,m,a[5005];
struct kth{
int l,r,value,k;
};
kth b[100005];
int32_t main(){
CODE_START;
cin>>n>>m;
for(ll i=1;i<=n;i++)
{
a[i]=-1;
}
for(ll i=1;i<=n;i++)
{
cin>>b[i].l>>b[i].r>>b[i].k>>b[i].value;
if(b[i].value==0){
ll j=b[i].l;
if(a[j]==1){
rc("-1");
}else a[j]=0;
}else if(b[i].value==1){
for(ll j=b[i].l;j<=b[i].r;j++)
{
if(a[j]==0){
rc("-1");
}
a[j]=1;
}
}
}
for(ll i=1;i<=n;i++)
{
if(a[i]==-1){
a[i]=1;
}
}
for(ll i=1;i<=n;i++)
{
cout<<a[i]<<' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |