Skip to content

Instantly share code, notes, and snippets.

@op01
Created October 12, 2013 11:17
Show Gist options
  • Save op01/6948875 to your computer and use it in GitHub Desktop.
Save op01/6948875 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<unistd.h>
#include<cstdio>
#include<sstream>
#include<string.h>
using namespace std;
int main()
{
int n;
cin>>n;
int sl[256];
for(int i=0;i<256;i++)
{
sl[i]=0;
}
for(int i=0;i<n;i++)
{
int l,h,r;
cin>>l>>h>>r;
for(int j=l;j<r;j++)
{
if(h>sl[j])sl[j] = h;
}
}
int earth=0;
for(int i=1;i<256;i++)
{
if(earth!=sl[i])
{
cout<<i<<" "<<sl[i]<<" ";
earth = sl[i];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment