QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#490064 | #8780. Training, Round 2 | yhddd | WA | 1ms | 4084kb | C++14 | 1.3kb | 2024-07-25 10:57:25 | 2024-07-25 10:57:25 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define mod 998244353ll
#define pii pair<int,int>
#define fi first
#define se second
#define mems(x,y) memset(x,y,sizeof(x))
using namespace std;
const int maxn=5010;
const int inf=1e18;
inline int read(){
int x=0,f=1;
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-48);ch=getchar();}
return x*f;
}
bool Mbe;
int n,a,b,ans;
set<int> s[maxn],vis[maxn];
void work(){
n=read();a=read(),b=read();
s[0].insert(0);
return ;
for(int i=1;i<=n;i++){
int la=read()-a,ra=read()-a,lb=read()-b,rb=read()-b;
if(ra<0||rb<0)continue;
la=max(la,0ll),ra=min(ra,n),lb=max(lb,0ll),rb=min(rb,n);
vector<pii> tmp;
for(int j=la;j<=lb;j++){
auto it=s[j].lower_bound(lb);
while(it!=s[j].end()&&(*it)<=rb){
tmp.push_back({j,(*it)+1}),tmp.push_back({j+1,(*it)});
vis[j].insert(*it);
it=s[j].erase(it);
}
}
for(pii p:tmp)if(vis[p.fi].find(p.se)==vis[p.fi].end()){
ans=max(ans,p.fi+p.se);
s[p.fi].insert(p.se);
}
}
printf("%lld\n",ans);
}
// \
444
bool Med;
int T;
signed main(){
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
// ios::sync_with_stdio(0);
// cin.tie(0);cout.tie(0);
// cerr<<(&Mbe-&Med)/1048576.0<<" MB\n";
T=1;
while(T--)work();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4084kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
result:
wrong answer 1st lines differ - expected: '3', found: ''