QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619131 | #2442. Welcome Party | IllusionaryDominance# | WA | 332ms | 13100kb | C++20 | 1011b | 2024-10-07 13:13:16 | 2024-10-07 13:13:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
struct people{
long long x, y;
}a[N];
bool pd(people p1, people p2){return p1.x < p2.x;}
long long suf[N];
int n;
int main(){
ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
int T; cin >> T;
while(T --){
for (int i = 1; i <= n; ++ i) suf[i] = 0;
cin >> n;
for (int i = 1; i <= n; ++ i) cin >> a[i].x >> a[i].y;
sort(a + 1, a + 1 + n, pd);
for (int i = n; i; -- i) suf[i] = max(suf[i + 1], a[i].y);
long long ans = 1e18;
set<long long>se;
for (int i = 1; i <= n; ++ i){
if(se.lower_bound(a[i].x) != se.end())
ans = min(ans, abs(max(*se.lower_bound(a[i].x), suf[i + 1]) - a[i].x));
if(se.lower_bound(a[i].x) != se.begin())
ans = min(ans, abs(max(*(--se.lower_bound(a[i].x)), suf[i + 1]) - a[i].x));
se.insert(a[i].y);
}
cout << ans << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 332ms
memory: 13100kb
input:
66 5 27 46 89 13 55 8 71 86 22 35 3 3 5 4 7 6 2 2 0 1000000000 1000000000 0 2 1000000000 0 0 1000000000 2 1000000000 0 1000000000 0 2 0 1000000000 0 1000000000 2 1000000000 1000000000 0 0 2 0 0 0 0 2 1000000000 1000000000 1000000000 1000000000 3 90 30 90 50 90 85 3 0 0 0 2 0 5 3 20 30 20 50 20 70 3 ...
output:
3 1 0 0 1000000000 1000000000 1000000000 0 0 5 0 10 5 10 3 0 10 5 0 5 2 30 10 10 3 0 10 5 0 146595730144168239 13421384895232913 21076180420813408 183538167814754058 46751451188711820 365292306661444331 23639646046527434 40476687889457528 288226349800603942 139940820548070767 48500389324554138 41398...
result:
wrong answer 21st lines differ - expected: '0', found: '2'