QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#296631 | #692. Delete the Points | gubshig | WA | 1ms | 3524kb | C++14 | 1.6kb | 2024-01-03 11:52:14 | 2024-01-03 11:52:15 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
int n, vx[3030], vy[3030], s[3030][3030];
bool vis[3030];
pii p[3030];
int sum(pii a, pii b){
int x1 = min(a.fi, b.fi) - 1, y1 = min(a.se, b.se) - 1;
int x2 = max(a.fi, b.fi), y2 = max(a.se, b.se);
return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1];
}
int main(){
cin.tie(nullptr)->sync_with_stdio(0);
cin >> n;
vi x(n), y(n);
for(int i = 1; i <= n; i++) cin >> p[i].fi >> p[i].se, x[i - 1] = p[i].fi, y[i - 1] = p[i].se;
sort(all(x));
x.resize(unique(all(x)) - x.begin());
sort(all(y));
y.resize(unique(all(y)) - y.begin());
for(int i = 1; i <= n; i++){
int nx = lower_bound(all(x), p[i].fi) - x.begin() + 1;
int ny = lower_bound(all(y), p[i].se) - y.begin() + 1;
vx[nx] = p[i].fi;
vy[ny] = p[i].se;
p[i].fi = nx;
p[i].se = ny;
s[nx][ny] = 1;
}
for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) s[i][j] += s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
cout << "Yes\n";
for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++){
if(i == j || vis[i] || vis[j] || sum(p[i], p[j]) > 2) continue;
int x1 = min(vx[p[i].fi], vx[p[j].fi]), y1 = min(vy[p[i].se], vy[p[j].se]);
int x2 = max(vx[p[i].fi], vx[p[j].fi]), y2 = max(vy[p[i].se], vy[p[j].se]);
cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << '\n';
vis[i] = 1;
vis[j] = 1;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3524kb
input:
4 1 1 2 2 5 5 6 6
output:
Yes 1 1 2 2 5 5 6 6
result:
ok OK
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3468kb
input:
4 0 0 1 2 2 1 4 4
output:
Yes 0 0 1 2 2 1 4 4
result:
wrong answer Not a square in query 1