QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60012 | #2337. Azulejos | captured# | WA | 3ms | 5776kb | C++17 | 1.3kb | 2022-11-02 16:24:26 | 2022-11-02 16:24:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e5+5;
struct D {
int p, h, idx;
} bck[maxn], frnt[maxn];
bool cmp(const D &a, const D &b) {
if (a.p == b.p) {
return a.h > b.h;
}
return a.p < b.p;
}
void solve(int cs){
int n, x;
cin>>n;
for (int i = 1; i <= n; i++) {
cin>>x;
bck[i].p = x;
}
for (int i = 1; i <= n; i++) {
cin>>x;
bck[i].h = x;
bck[i].idx = i;
}
for (int i = 1; i <= n; i++) {
cin>>x;
frnt[i].p = x;
}
for (int i = 1; i <= n; i++) {
cin>>x;
frnt[i].h = x;
frnt[i].idx = i;
}
sort(bck+1, bck+n+1, cmp);
sort(frnt+1, frnt+n+1, cmp);
int f = 0;
for (int i = 1; i<= n; i++) {
if (bck[i].h <= frnt[i].h) {
f = 1;
break;
}
}
if (f == 1) {
cout<<"impossible\n";
return;
}
for (int i = 1; i<=n; i++) {
cout<<bck[i].idx<<" ";
}
cout<<"\n";
for (int i = 1; i<=n; i++) {
cout<<frnt[i].idx<<" ";
}
cout<<"\n";
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t;t=1;
//cin>>t;
for(int cs=1;cs<=t;cs++)solve(cs);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 5616kb
Test #2:
score: 0
Accepted
time: 2ms
memory: 5696kb
Test #3:
score: 0
Accepted
time: 2ms
memory: 5776kb
Test #4:
score: 0
Accepted
time: 2ms
memory: 5632kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 5696kb
Test #6:
score: 0
Accepted
time: 2ms
memory: 5636kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 5656kb
Test #8:
score: -100
Wrong Answer
time: 2ms
memory: 5708kb