2 条题解
-
0
by hansang:
#include<bits/stdc++.h> using namespace std; const int N=2e4+10; int a[N]; map<int, int> mp[7]; bool cmp(int x, int y){ int res=0; for(int i=1; i<=5; i++){ if(mp[i][x]<mp[i][y]) res++; } return (res>=3); } int main(){ int n; scanf("%d", &n); for(int i=1; i<=5; i++) for(int j=1; j<=n; j++){ scanf("%d", &a[j]); mp[i][a[j]]=j; } sort(a+1, a+n+1, cmp); for(int i=1; i<=n; i++) printf("%d\n", a[i]); printf("\n"); return 0; } -
0
by hansang:
#include<bits/stdc++.h> using namespace std; const int N=2e4+10; int a[N]; map<int, int> mp[7]; bool cmp(int x, int y){ int res=0; for(int i=1; i<=5; i++){ if(mp[i][x]<mp[i][y]) res++; } return (res>=3); } int main(){ int n; scanf("%d", &n); for(int i=1; i<=5; i++) for(int j=1; j<=n; j++){ scanf("%d", &a[j]); mp[i][a[j]]=j; } sort(a+1, a+n+1, cmp); for(int i=1; i<=n; i++) printf("%d\n", a[i]); printf("\n"); return 0; }
- 1
信息
- ID
- 2621
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 9
- 标签
- 递交数
- 7
- 已通过
- 5
- 上传者