# 为什么排序了还是10分

@fz风 2019-01-19 09:38 回复

using namespace std;
int main()
{
int x1[1005], y1[1005], a[1005], b[1005];
int m, n, k, d, l;
cin >> m >> n >> k >> l >> d;
int x, xx, y, yy;
for (int i = 1; i <= d; i++) {
cin >> y >> x >> yy >> xx;
if (x == xx) {
y = min(y, yy);
y1[y]++;
}
else x1[min(x, xx)]++;
}

for (int i = 1; i <= k; i++) {
int max = 0;
int o;
for (int q = 1; q <m; q++) {
if (y1[q] > max) {
max = y1[q];
o = q;
}
}
a[i] = o;
y1[o] = 0;//0x00F530E4 处(位于 Project2.exe 中)引发的异常: 0xC0000005: 写入位置 0x91DD0E5C 时发生访问冲突。
}

for (int i = 1; i <= l; i++) {
int max = 0, o;
for (int q = 1; q <n; q++) {
if (x1[q] > max) {
max = x1[q];
o = q;
}
}
x1[o] = 0;
b[i] = o;
}
if (k == 1)cout << a[1] << endl;
else {
for (int i = 1; i <k; i++) {
cout << a[i] << ' ';
}
cout << a[k] << endl;
}
if (l == 1)cout << b[1];
else {
for (int i = 1; i <l; i++) {
cout << b[i] << ' ';
}
cout << b[l];
}
//system("pause");
return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
int x1[1005], y1[1005],a[1005],b[1005];
int m, n, k, d, l;
cin >> m >> n >> k >> l >> d;
int x, xx, y, yy;
for (int i = 1; i <= d; i++) {
cin >> y >> x >> yy >> xx;
if (x == xx) {
y = min(y, yy);
y1[y]++;
}
else x1[min(x, xx)]++;
}

for (int i = 1; i <= k; i++) {
int max=0;
int o;
for (int q = 1; q <m; q++) {
if (y1[q] > max) {
max = y1[q];
o = q;
}
}
a[o]++;
y1[o]=0;
}

for (int i = 1; i <= l; i++) {
int max=0,o;
for (int q = 1; q <n; q++) {
if (x1[q] > max) {
max = x1[q];
o = q;
}
}
x1[o]=0;
b[o]++;
}
m=0;
for (int i = 1; i <1005 ; i++) {
if(a[i]&&m!=k-1){
cout<<a[i]<<' ';
m++;
}
if(a[i]&&m==k-1){
cout<<a[i]<<endl;
break;
}
}
m=0;
for (int i = 1; i <1005; i++) {
if(b[i]&&m!=l-1){
cout<<b[i]<<' ';
m++;
}
if(b[i]&&m==l-1){
cout<<b[i];
break;
}
}
//system("pause");
return 0;
}
@fz风 2019-01-19 09:38 回复

@fz风 2019-01-19 09:45 回复
m=0;
for (int i = 1; i <1005; i++) {
if(b[i]&&m!=l-1){
cout<<i<<' ';
m++;
}
if(b[i]&&m==l-1){
cout<<i;
break;
}
}
//system("pause");
return 0;
}

@LattleGrass 2019-02-08 01:21 回复