Submission #1791289
Source Code Expand
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
int x;char c;
while((c=getchar())<'0'||c>'9');
for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
return x;
}
#define MN 200000
#define N 262144
#define MOD 1000000007
struct P{int x,y;}p[MN+5];
bool cmpx(const P&a,const P&b){return a.x<b.x;}
bool cmpy(const P&a,const P&b){return a.y<b.y;}
int t[N*2+5];
inline void InC(int&a,int b){if((a+=b)>=MOD)a-=MOD;}
inline void MiN(int&a,int b){if(b<a)a=b;}
inline void MaX(int&a,int b){if(b>a)a=b;}
void add(int k,int x,void(*rw)(int&,int)){for(k+=N;k;k>>=1)rw(t[k],x);}
int query(int l,int r,void(*rw)(int&,int))
{
int res=t[0];
for(l+=N-1,r+=N+1;l^r^1;l>>=1,r>>=1)
{
if(~l&1)rw(res,t[l+1]);
if( r&1)rw(res,t[r-1]);
}
return res;
}
int main()
{
int n=read(),i;
for(i=1;i<=n;++i)p[i].x=read(),p[i].y=read();
sort(p+1,p+n+1,cmpx);
for(i=1;i<=n;++i)p[i].x=i;
sort(p+1,p+n+1,cmpy);
memset(t,40,sizeof(t));
for(i=1;i<=n;++i)add(p[i].x,i,MiN),p[i].y=query(p[i].x,n,MiN);
memset(t,0,sizeof(t));
for(i=n;i;--i)add(p[i].x,i,MaX),p[i].x=query(1,p[i].x,MaX);
sort(p+1,p+n+1,cmpy);
memset(t,0,sizeof(t));add(0,1,InC);
for(i=1;i<=n;++i)add(p[i].x,query(p[i].y-1,n,InC),InC);
printf("%d",t[n+N]);
}
Submission Info
Submission Time |
|
Task |
E - Mr.Aoki Incubator |
User |
ditoly |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1300 Byte |
Status |
WA |
Exec Time |
170 ms |
Memory |
3712 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 1200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
s1.txt, s2.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, s1.txt, s2.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
WA |
153 ms |
3712 KB |
02.txt |
WA |
159 ms |
3712 KB |
03.txt |
WA |
165 ms |
3712 KB |
04.txt |
WA |
153 ms |
3712 KB |
05.txt |
WA |
156 ms |
3712 KB |
06.txt |
WA |
170 ms |
3712 KB |
07.txt |
WA |
161 ms |
3712 KB |
08.txt |
WA |
152 ms |
3712 KB |
09.txt |
AC |
145 ms |
3712 KB |
10.txt |
AC |
121 ms |
3712 KB |
11.txt |
AC |
141 ms |
3712 KB |
12.txt |
AC |
150 ms |
3712 KB |
13.txt |
WA |
136 ms |
3712 KB |
14.txt |
WA |
143 ms |
3712 KB |
15.txt |
WA |
152 ms |
3712 KB |
16.txt |
WA |
138 ms |
3712 KB |
17.txt |
AC |
137 ms |
3712 KB |
18.txt |
AC |
152 ms |
3712 KB |
19.txt |
AC |
138 ms |
3712 KB |
20.txt |
AC |
139 ms |
3712 KB |
21.txt |
WA |
149 ms |
3712 KB |
22.txt |
WA |
142 ms |
3712 KB |
23.txt |
WA |
143 ms |
3712 KB |
24.txt |
WA |
151 ms |
3712 KB |
25.txt |
WA |
123 ms |
3712 KB |
26.txt |
WA |
131 ms |
3712 KB |
27.txt |
WA |
141 ms |
3712 KB |
28.txt |
WA |
123 ms |
3712 KB |
29.txt |
AC |
130 ms |
3712 KB |
30.txt |
AC |
146 ms |
3712 KB |
31.txt |
AC |
2 ms |
2176 KB |
32.txt |
AC |
2 ms |
2176 KB |
33.txt |
WA |
2 ms |
2176 KB |
34.txt |
AC |
2 ms |
2176 KB |
s1.txt |
WA |
2 ms |
2176 KB |
s2.txt |
AC |
2 ms |
2176 KB |