交了无数遍,错了无数遍。
现在这一版代码:
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int n, w, h, x, y, cnt, res, ans[5005];
struct node
{
int x, y, id;
} a[5005];
bool operator<(node x, node y)
{
if(x.x < y.x) return x.y < y.y;
return false;
}
map<node, bool> mp;
int main()
{
cin >> n >> w >> h;
for(int i = 1; i <= n; i++)
{
cin >> x >> y;
if(x <= w || y <= h) continue;
if(mp.count(node{x, y})) continue;
mp[node{x, y, 0}] = true;
cnt++;
a[cnt] = node{x, y, i};
}
sort(a + 1, a + cnt + 1);
if(cnt)
{
ans[++res] = a[1].id;
for(int i = 2; i <= cnt; i++)
if(a[i].x != a[i - 1].x && a[i].y != a[i - 1].y)
ans[++res] = a[i].id;
cout << res << endl;
if(res)
{
for(int i = 1; i <= res; i++)
cout << ans[i] << ' ';
cout << endl;
}
}
else cout << 0 << endl;
return 0;
}
#10 WA:
输入:
5 1000 998
5002 5005
5003 5004
5003 5002
5002 5001
5002 5002
错误输出:
1
1
正确输出:
2
4 3
评测机返回:
wrong answer Jury's answer 2 is better than participant's 1
在线等,急