提交记录 9825
| 提交时间 |
评测时间 |
| 2019-07-16 17:18:12 |
2020-08-01 01:54:49 |
#include <bits/stdc++.h>
#define N 25
#define getchar nc
using namespace std;
inline char nc(){
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int read()
{
register int x=0,f=1;register char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
return x*f;
}
inline void write(register int x)
{
if(!x)putchar('0');if(x<0)x=-x,putchar('-');
static int sta[20];register int tot=0;
while(x)sta[tot++]=x%10,x/=10;
while(tot)putchar(sta[--tot]+48);
}
int n,a[N],b[N];
int v[N];
inline int check()
{
for(register int i=1;i<=n;++i)
{
int l=0,r=0;
for(register int j=i-1;j>=1;--j)
{
if(v[j]>v[i])
break;
++l;
}
for(register int j=i+1;j<=n;++j)
{
if(v[j]>=v[i])
break;
++r;
}
//printf("%d %d\n",l,r);
if(fabs(r-l)>2)
return 0;
}
return 1;
}
inline int dfs(register int dep)
{
int res=0;
if(dep==n+1)
return check();
for(register int i=a[dep];i<=b[dep];++i)
v[dep]=i,res+=dfs(dep+1);
return res;
}
int main()
{
n=read();
for(register int i=1;i<=n;++i)
a[i]=read(),b[i]=read();
write(dfs(1));
return 0;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 33.18 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #2 | 39.16 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #3 | 103.39 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #4 | 76.83 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #5 | 3 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #6 | 7.876 ms | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #7 | 3 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #8 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #9 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #10 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #11 | 1.111 s | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #12 | 1.111 s | 40 KB | Wrong Answer | Score: 0 | 显示更多 |
| Testcase #13 | 3 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #14 | 3 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #15 | 3 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #16 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #17 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #18 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #19 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #20 | 3 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-30 16:00:34 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠