QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#380940 | #5513. Advertisement 2 | stegatxins0# | 10 | 273ms | 29400kb | C++20 | 1.5kb | 2024-04-07 15:15:35 | 2024-07-04 03:33:38 |
Judging History
answer
// {{{
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif
using ll = long long;
const int inf = 1073741823;
const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define rep(i, b) for (auto i = 0; i < (b); i++)
#define reps(i, b) for (auto i = 1; i <= (b); i++)
// }}}
const int mxN = 500001;
int n,ans,curx,cure;
bool visited[mxN];
//bool influ[500001][500001];
struct node{
int x,e;
}re[mxN];
bool cmp(const node a, const node b){
return a.e > b.e;
}
int main() {
scanf("%d",&n);
bool subtask1=1;
memset(visited,0,sizeof(visited));
for(int i=1; i<=n; i++){
scanf("%d%d",&re[i].x,&re[i].e);
if(i>1 && re[i].e != re[i-1].e)subtask1=0;
}
if(subtask1){
set<int> ss;
for(int i=1; i<=n; i++){
ss.insert(re[i].x);
}
printf("%d",(int)ss.size());
return 0;
}
sort(re+1, re+n+1, cmp);
bool allclear=0;
for(int i=1; i<=n; i++){
allclear=1;
curx = re[i].x;
cure = re[i].e;
visited[i] = 1;
for(int j=1; j<=n; j++){
if(cure - re[j].e >= abs(curx - re[j].x))visited[j] = 1;
if(!visited[j])allclear=0;
}
if(allclear){ans=i; break;}
}
printf("%d",ans);
}
// subtask 1, since all e is equal, just count the number of unique coordinates
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 45ms
memory: 10812kb
input:
128800 9199612 51970557 152303663 51970557 658020283 51970557 305169975 51970557 647937895 51970557 162441995 51970557 664350717 51970557 128813867 51970557 815800777 51970557 422654970 51970557 5325941 51970557 919605369 51970557 775929588 51970557 957253076 51970557 441558150 51970557 730596606 51...
output:
116732
result:
ok single line: '116732'
Test #2:
score: 0
Accepted
time: 45ms
memory: 10304kb
input:
178516 481507914 185523732 434623365 185523732 472444125 185523732 759573017 185523732 253426284 185523732 700756636 185523732 74218273 185523732 978855318 185523732 193027753 185523732 670445963 185523732 647115447 185523732 355737335 185523732 213219833 185523732 580124162 185523732 361750049 1855...
output:
77180
result:
ok single line: '77180'
Test #3:
score: 0
Accepted
time: 77ms
memory: 8336kb
input:
462572 101498948 303922224 642297835 303922224 417145698 303922224 889349783 303922224 434461522 303922224 93863358 303922224 215632530 303922224 832856402 303922224 703199983 303922224 809081237 303922224 557497978 303922224 655494326 303922224 195187810 303922224 812819691 303922224 814441567 3039...
output:
4625
result:
ok single line: '4625'
Test #4:
score: 0
Accepted
time: 36ms
memory: 7400kb
input:
325752 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840273835 619184372 840...
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 273ms
memory: 29400kb
input:
500000 432233751 37126744 876209848 37126744 115636122 37126744 722895189 37126744 385407335 37126744 631777770 37126744 640127217 37126744 850533001 37126744 857281519 37126744 47214872 37126744 67273107 37126744 817606002 37126744 197019377 37126744 816304624 37126744 780928469 37126744 991314112 ...
output:
453173
result:
ok single line: '453173'
Test #6:
score: 0
Accepted
time: 144ms
memory: 18316kb
input:
500000 347979517 402569575 240027608 402569575 984267933 402569575 490577061 402569575 248258763 402569575 866530973 402569575 301265202 402569575 736701829 402569575 47460490 402569575 878566519 402569575 485021670 402569575 978430003 402569575 530094575 402569575 51797713 402569575 975446346 40256...
output:
216136
result:
ok single line: '216136'
Test #7:
score: 0
Accepted
time: 83ms
memory: 8680kb
input:
500000 394843641 428581569 931365318 428581569 205656498 428581569 325306857 428581569 567772605 428581569 495792279 428581569 521260039 428581569 275722970 428581569 168204637 428581569 882738248 428581569 211294121 428581569 236121938 428581569 498382424 428581569 406387147 428581569 664092862 428...
output:
5000
result:
ok single line: '5000'
Test #8:
score: 0
Accepted
time: 63ms
memory: 8452kb
input:
500000 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502907510 180068482 502...
output:
1
result:
ok single line: '1'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 23
Accepted
time: 1ms
memory: 4532kb
input:
3 231636235 354089104 228392707 930073348 587735804 575683740
output:
2
result:
ok single line: '2'
Test #10:
score: 0
Accepted
time: 1ms
memory: 4548kb
input:
2 44803615 325394921 960290812 913042209
output:
2
result:
ok single line: '2'
Test #11:
score: 0
Accepted
time: 1ms
memory: 4260kb
input:
16 358962202 959156048 292228464 457977429 286504790 688097514 10235865 287544591 543037593 223202351 281739475 678894125 340538778 135823278 523049160 699098750 632448464 27592532 678838907 280282008 232201876 610344934 372201424 580697311 534022553 149440684 396794335 231096472 386573567 674797431...
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 0ms
memory: 4536kb
input:
16 991478601 586353863 727677584 413218995 848190574 721774939 337154838 587621991 326181535 330546474 885714927 902337871 321925936 254469460 389203245 713455202 269046070 768322315 614176036 221983130 199199666 945777980 333801969 632191948 426251079 645513607 230568723 962651792 817646607 6209057...
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 1ms
memory: 4152kb
input:
16 259716405 81082178 865953834 204158972 701456061 326495636 534687353 313425011 649435476 973258810 655435866 100458236 842552753 181656857 473079491 116991153 2508936 173927847 405046133 391068638 302771733 495790124 35966251 515357032 272182509 442914085 348221691 938487780 990378664 943640991 2...
output:
3
result:
ok single line: '3'
Test #14:
score: -23
Wrong Answer
time: 0ms
memory: 5840kb
input:
16 750613470 787418986 170979548 365164484 538034539 608096710 860751449 225707539 484373402 547435035 940351136 194668865 912301765 93898337 458896779 93991117 604496090 637207865 887366195 906979783 557233961 724709014 79115098 854994617 46404315 744331005 915505818 998759323 415682887 70000722 24...
output:
6
result:
wrong answer 1st lines differ - expected: '3', found: '6'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%