QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#274624 | #6136. Airdrop | C1942huangjiaxu | Compile Error | / | / | C++14 | 1.3kb | 2023-12-03 19:04:12 | 2023-12-03 19:04:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int T,n,y0,a[N],ca,mx,mn,pr[N],su[N];
vector<int>e[N];
struct po{
int x,y;
}p[N];
set<int>S;
void solve(){
scanf("%d%d",&n,&y0);
for(int i=1;i<=n;++i){
scanf("%d%d",&p[i].x,&p[i].y);
p[i].y=abs(p[i].y-y0);
a[i]=p[i].x;
}
sort(a+1,a+n+1);
ca=unique(a+1,a+n+1)-a-1;
for(int i=1;i<=ca;++i)e[i].clear();
for(int i=1;i<=n;++i){
p[i].x=lower_bound(a+1,a+ca+1,p[i].x)-a;
e[p[i].x].push_back(p[i].y);
}
for(int i=1;i<=ca;++i)sort(e[i].begin(),e[i].end());
mx=0,mn=n,su[ca+1]=0;
S.clear();
for(int i=1,ad=0;i<=ca;++i){
vector<int>g;
for(auto v:e[i]){
if(S.count(v-ad))g.push_back(v-ad);
S.insert(v-ad);
}
for(auto v:g)S.erase(v);
pr[i]=S.size();
ad+=a[i+1]-a[i];
}
S.clear();
for(int i=ca,ad=0;i;--i){
vector<int>g;
for(auto v:e[i]){
if(S.count(v-ad))g.push_back(v-ad);
S.insert(v-ad);
}
for(auto v:g)S.erase(v);
su[i]=S.size();
ad+=a[i]-a[i-1];
}
for(int i=1;i<=ca;++i){
mx=max(mx,pr[i-1]+su[i+1]+(int)e[i].size()),mn=min(mn,pr[i-1]+su[i+1]+(int)e[i].size());
mx=max(mx,pr[i-1]+su[i]),mn=min(mn,pr[i-1]+su[i]);
}
mx=max(mx,pr[n]),mn=min(mn,pr[n]);
printf("%d %d\n",mn,mx);
}
int main(){
scanf("%d",&T);
while(T--)solve();
return 0;
}
詳細信息
answer.code:4:9: error: ‘int y0’ redeclared as different kind of entity 4 | int T,n,y0,a[N],ca,mx,mn,pr[N],su[N]; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586, from /usr/include/c++/11/cassert:43, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’ 220 | __MATHCALL (y0,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘void solve()’: answer.code:11:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘double (*)(double) throw ()’ {aka ‘double (*)(double)’} [-Wformat=] 11 | scanf("%d%d",&n,&y0); | ~^ ~~~ | | | | int* double (*)(double) throw () {aka double (*)(double)} answer.code:14:34: error: invalid operands of types ‘int’ and ‘double(double) throw ()’ {aka ‘double(double)’} to binary ‘operator-’ 14 | p[i].y=abs(p[i].y-y0); | ~~~~~~^~~ | | | | | double(double) throw () {aka double(double)} | int answer.code:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&n,&y0); | ~~~~~^~~~~~~~~~~~~~~ answer.code:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d%d",&p[i].x,&p[i].y); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:56:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 56 | scanf("%d",&T); | ~~~~~^~~~~~~~~