QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#719191#880. Film CriticsqwerasdfWA 0ms3808kbC++201.1kb2024-11-06 23:15:212024-11-06 23:15:22

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 23:15:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3808kb
  • [2024-11-06 23:15:21]
  • 提交

answer

//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder; //https://github.com/atcoder/ac-library

#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define bit(n, k) ((n >> k) & 1)
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> pii;

void test_case(int tt){
    int n,m,k; cin>>n>>m>>k;
    if(k%m){
        cout<<"impossible\n";
        return;
    }
    k/=m;
    vector<pii> a(n);
    rep(i,0,n)cin>>a[i].first,a[i].second=i+1;
    sort(all(a));
    vector<int> ans(n,0);
    ans[0]=a[n-k].second;
    int l=n-k-1,r=n-k+1;
    ll sum=m;
    rep(i,1,n){
        if(l>=0 && 1LL*a[l].first*i<sum)ans[i]=a[l--].second;
        else if(r<n && 1LL*a[r].first*i>=sum)ans[i]=a[r++].second,sum+=m;
        else{
            cout<<"impossible\n";
            return;
        }
    }
    rep(i,0,n)cout<<ans[i]<<' ';
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    //cin>>t;
    rep(i, 1, t + 1)
    {
        test_case(i);
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

input:

5 10 30
10 5 3 1 3

output:

5 3 4 2 1 

result:

ok OK!

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

5 5 20
5 3 3 3 3

output:

impossible

result:

ok OK!

Test #3:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

5 10 20
6 1 9 3 2

output:

1 4 5 2 3 

result:

ok OK!

Test #4:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

5 10 20
5 3 10 7 10

output:

3 4 5 1 2 

result:

ok OK!

Test #5:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

5 10 30
1 0 1 8 5

output:

3 1 2 5 4 

result:

ok OK!

Test #6:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

5 10 30
2 0 5 4 2

output:

5 1 2 4 3 

result:

ok OK!

Test #7:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

100 10 100
10 10 4 8 10 0 7 8 3 3 2 3 1 8 1 5 0 0 3 3 7 10 10 5 1 9 4 3 4 5 6 5 2 7 5 6 5 0 4 9 7 0 6 5 8 0 9 3 2 3 0 4 4 10 9 0 1 0 2 3 1 5 3 8 0 1 10 7 2 10 3 9 3 10 7 7 0 7 1 6 6 3 7 7 6 9 10 8 3 1 7 9 10 9 8 5 5 0 8 4

output:

impossible

result:

ok OK!

Test #8:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

100 10 500
6 3 9 7 6 9 0 9 2 8 1 3 1 6 1 0 5 9 5 0 8 6 6 6 4 5 9 10 9 1 4 6 4 7 0 2 10 6 8 3 10 10 10 6 4 2 9 1 3 7 6 8 2 9 8 7 8 2 4 0 0 4 0 1 8 3 9 3 3 9 5 5 5 10 5 0 2 1 7 3 1 1 7 3 10 8 6 1 4 2 9 2 2 7 7 9 8 9 3 10

output:

75 73 1 72 5 71 14 26 22 19 23 17 89 62 59 24 45 33 32 31 38 25 99 84 80 69 68 66 49 40 44 12 2 93 92 90 77 58 53 46 36 9 88 82 81 78 64 48 30 15 13 11 76 63 61 60 35 20 16 7 51 87 4 34 50 56 79 83 94 95 10 21 39 52 55 57 65 86 97 3 6 8 18 27 29 47 54 67 70 91 96 98 28 37 41 42 43 74 85 100 

result:

ok OK!

Test #9:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

100 10 700
4 1 4 5 1 0 5 4 10 1 1 7 3 5 9 7 10 8 0 5 3 5 10 3 6 6 3 7 8 9 2 5 7 7 7 2 2 5 5 1 8 5 9 9 7 9 0 8 7 4 0 1 7 7 0 5 4 2 10 5 6 0 6 4 7 7 3 0 8 8 10 0 3 6 9 7 9 9 1 5 5 1 3 7 6 2 4 1 6 5 10 7 1 9 2 10 8 10 6 2

output:

73 67 27 24 83 21 13 100 95 86 1 58 37 36 31 93 88 82 79 52 40 11 10 5 2 72 68 62 55 51 47 19 6 3 8 50 57 64 87 4 7 14 20 22 32 38 39 42 56 60 80 81 90 25 26 61 63 74 85 89 99 12 16 28 33 34 35 45 49 53 54 65 66 76 84 92 18 29 41 48 69 70 97 15 30 43 44 46 75 77 78 94 9 17 23 59 71 91 96 98 

result:

ok OK!

Test #10:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

1 1234 1234
1013

output:

1 

result:

ok OK!

Test #11:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1 1234 1233
624

output:

impossible

result:

ok OK!

Test #12:

score: -100
Wrong Answer
time: 0ms
memory: 3608kb

input:

1 1234 0
687

output:

0 

result:

wrong answer Contestant printed N integers, but it wasn't a permutation.