Submission #331404

# Submission time Handle Problem Language Result Execution time Memory
331404 2020-11-28T11:08:19 Z Sho10 Restore Array (RMI19_restore) C++14
13 / 100
12 ms 748 KB
#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<=m;i++)
{
    cin>>b[i].l>>b[i].r>>b[i].k>>b[i].value;
    b[i].l++;
    b[i].r++;
    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]=0;
    }
}
for(ll i=1;i<=n;i++)
{
    if(b[i].value==0){
            ll s1=0;
        for(ll j=b[i].l;j<=b[i].r;j++)
        {
            if(a[j]==0){
                s1=1;
            }
        }
        if(s1==0){
            rc("-1");
        }
    }
}
for(ll i=1;i<=n;i++)
{
    cout<<a[i]<<' ';
}
}
/*
Subtask 1:
4 5
0 1 2 1
0 2 2 0
2 2 1 0
0 1 1 0
1 2 1 0
Subtask 2:
4 5
1 1 1 1
0 2 1 0
2 2 1 0
0 1 1 0
1 2 1 0
*/

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 492 KB Output is correct
2 Correct 8 ms 748 KB Output is correct
3 Correct 8 ms 620 KB Output is correct
4 Correct 8 ms 748 KB Output is correct
5 Correct 9 ms 620 KB Output is correct
6 Correct 8 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 492 KB Output is correct
2 Correct 8 ms 748 KB Output is correct
3 Correct 8 ms 620 KB Output is correct
4 Correct 8 ms 748 KB Output is correct
5 Correct 9 ms 620 KB Output is correct
6 Correct 8 ms 620 KB Output is correct
7 Incorrect 12 ms 620 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -