Submission #1590078
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }
const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
int main(void){
ll n,dp[405]={};
ll result=0,min=INF,max=0,l,r;
cin>>n;
if(n>401) return 0;
REP(i,n){
cin>>l>>r;
dp[l]++;dp[r+1]--;
chmin(min,l);chmax(max,r+1);
}
FOR(i,min+1,max){
dp[i]+=dp[i-1];
if(dp[i]==0) result++;
}
cout<<result<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
E - NarrowRectangles |
User |
stnae678 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1180 Byte |
Status |
RE |
Exec Time |
94 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
Subtask |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
0 / 700 |
Status |
|
|
|
Set Name |
Test Cases |
Sample |
0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt |
Subtask |
0_000, 0_001, 0_004, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt |
All |
0_000.txt, 0_001.txt, 0_002.txt, 0_003.txt, 0_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 2_018.txt, 2_019.txt, 2_020.txt, 2_021.txt, 2_022.txt, 2_023.txt, 2_024.txt, 2_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt, 2_030.txt, 2_031.txt, 2_032.txt, 2_033.txt, 2_034.txt, 2_035.txt, 2_036.txt |
Case Name |
Status |
Exec Time |
Memory |
0_000.txt |
WA |
1 ms |
256 KB |
0_001.txt |
AC |
1 ms |
256 KB |
0_002.txt |
RE |
94 ms |
256 KB |
0_003.txt |
RE |
94 ms |
256 KB |
0_004.txt |
AC |
1 ms |
256 KB |
1_005.txt |
WA |
1 ms |
256 KB |
1_006.txt |
WA |
1 ms |
256 KB |
1_007.txt |
AC |
1 ms |
256 KB |
1_008.txt |
WA |
1 ms |
256 KB |
1_009.txt |
WA |
1 ms |
256 KB |
1_010.txt |
WA |
1 ms |
256 KB |
1_011.txt |
WA |
1 ms |
256 KB |
1_012.txt |
WA |
1 ms |
256 KB |
1_013.txt |
WA |
1 ms |
256 KB |
1_014.txt |
WA |
1 ms |
256 KB |
1_015.txt |
WA |
1 ms |
256 KB |
1_016.txt |
WA |
1 ms |
256 KB |
1_017.txt |
WA |
1 ms |
256 KB |
2_018.txt |
WA |
1 ms |
256 KB |
2_019.txt |
WA |
1 ms |
256 KB |
2_020.txt |
WA |
1 ms |
256 KB |
2_021.txt |
WA |
1 ms |
256 KB |
2_022.txt |
WA |
1 ms |
256 KB |
2_023.txt |
WA |
1 ms |
256 KB |
2_024.txt |
WA |
1 ms |
256 KB |
2_025.txt |
WA |
1 ms |
256 KB |
2_026.txt |
WA |
1 ms |
256 KB |
2_027.txt |
WA |
1 ms |
256 KB |
2_028.txt |
WA |
1 ms |
256 KB |
2_029.txt |
WA |
1 ms |
256 KB |
2_030.txt |
WA |
1 ms |
256 KB |
2_031.txt |
WA |
1 ms |
256 KB |
2_032.txt |
WA |
1 ms |
256 KB |
2_033.txt |
WA |
1 ms |
256 KB |
2_034.txt |
WA |
1 ms |
256 KB |
2_035.txt |
WA |
1 ms |
256 KB |
2_036.txt |
WA |
1 ms |
256 KB |