ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#208791 | #3765. 差距 | Yhlms | 100 | 364ms | 5940kb | C++11 | 1.3kb | 2024-08-03 10:41:03 | 2024-08-03 12:16:08 |
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
//fixed << setprecision()
const int length = 2e5 + 5;
struct Point
{
int x, y;
int quadrant;
};
int n;
Point point[length];
pair<int, int> q[5];
inline int dis(int xx, int xxx, int yy, int yyy)
{
return abs(xx - xxx) + abs(yy - yyy);
}
signed main()
{
ios::sync_with_stdio(false);
cin >> n;
for(int i = 1;i <= n;i++)
{
cin >> point[i].x >> point[i].y;
if(point[i].x >= 0 && point[i].y >= 0)
point[i].quadrant = 1;
if(point[i].x < 0 && point[i].y >= 0)
point[i].quadrant = 2;
if(point[i].x <= 0 && point[i].y <= 0)
point[i].quadrant = 3;
if(point[i].x > 0 && point[i].y <= 0)
point[i].quadrant = 4;
//cout << point[i].quadrant << endl;
int qqq = point[i].quadrant;
int xxx = point[i].x;
int yyy = point[i].y;
if(dis(xxx, 0, yyy, 0) > dis(q[qqq].first, 0, q[qqq].second, 0))
{
q[qqq].first = xxx;
q[qqq].second = yyy;
}
}
int ans = -1;
for(int i = 1;i <= 4;i++)
{
for(int j = 1;j <= 4;j++)
{
if(dis(q[i].first, q[j].first, q[i].second, q[j].second) > ans)
{
ans = dis(q[i].first, q[j].first, q[i].second, q[j].second);
}
}
}
cout << ans << endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 2ms
memory: 1320kb
input:
3000 792453998 306958027 996204014 600915334 -981568884 236264724 470759953 606485180 -53238153 -555...
output:
3941875385
result:
ok single line: '3941875385'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1320kb
input:
3000 79975810 212758591 -601603486 -625555123 -708207563 -951706306 774109860 63713456 -946878280 50...
output:
3917242036
result:
ok single line: '3917242036'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1324kb
input:
3000 691369894 -8116153 -443993089 719627429 -784315238 -928459306 271872303 -657587041 245813343 30...
output:
3960933529
result:
ok single line: '3960933529'
Test #4:
score: 10
Accepted
time: 63ms
memory: 5936kb
input:
200000 599323188 0 -843037110 0 518683150 0 -159076766 0 588819428 0 56209470 0 855323935 0 10073519...
output:
1999957119
result:
ok single line: '1999957119'
Test #5:
score: 10
Accepted
time: 59ms
memory: 5936kb
input:
200000 480502842 0 139974590 0 -311006285 0 296111828 0 -96216923 0 491915067 0 741774257 0 70377442...
output:
1999984073
result:
ok single line: '1999984073'
Test #6:
score: 10
Accepted
time: 67ms
memory: 5940kb
input:
200000 -713216891 0 897961748 0 -746428112 0 -906216677 0 -319987275 0 920073294 0 -47674064 0 18432...
output:
1999970653
result:
ok single line: '1999970653'
Test #7:
score: 10
Accepted
time: 45ms
memory: 5940kb
input:
200000 37685867 -780251225 743094375 -127258779 -135245284 -324381032 117211694 -763086777 544186852...
output:
3995976829
result:
ok single line: '3995976829'
Test #8:
score: 10
Accepted
time: 42ms
memory: 5936kb
input:
200000 272655496 813504818 -63935068 844884673 329969667 -935497929 939027783 774905192 63872339 -61...
output:
3988926702
result:
ok single line: '3988926702'
Test #9:
score: 10
Accepted
time: 41ms
memory: 5940kb
input:
200000 931816546 -929771953 478933054 204368625 -513722829 814068200 424836471 -113036793 -288435765...
output:
3989038088
result:
ok single line: '3989038088'
Test #10:
score: 10
Accepted
time: 45ms
memory: 5936kb
input:
200000 559626386 634020933 549422179 -500273550 281287608 320750484 67874874 196515538 -116637058 37...
output:
3994387298
result:
ok single line: '3994387298'
Extra Test:
score: 0
Extra Test Passed