QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#60012#2337. Azulejoscaptured#WA 3ms5776kbC++171.3kb2022-11-02 16:24:262022-11-02 16:24:29

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-02 16:24:29]
  • Judged
  • Verdict: WA
  • Time: 3ms
  • Memory: 5776kb
  • [2022-11-02 16:24:26]
  • Submitted

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