QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#191648 | #880. Film Critics | ZhouShang | WA | 1ms | 5572kb | C++14 | 560b | 2023-09-30 06:28:18 | 2023-09-30 06:28:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,m,k,A[1<<20],s,l,r,x;
pair<int,int>p[1<<20];
int main(){
cin>>n>>m>>k;
if(k%m!=0||k==0)
cout<<"impossible\n",exit(0);
k/=m;
for(int i=1;i<=n;i++)
cin>>x,p[i]={x,i};
sort(p+1,p+n+1),l=k-1,r=k+1,A[1]=p[k].second,s=1;
for(int i=2;i<=n;i++){
if(l&&s*m>p[l].first*(i-1)){
A[i]=p[l--].second;
continue;
}
if(r<=n&&s*m<=p[r].first*(i-1)){
A[i]=p[r++].second,s++;
continue;
}
cout<<"impossible\n",exit(0);
}
for(int i=1;i<=n;i++)
cout<<A[i]<<" \n"[i==n];
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5460kb
input:
5 10 30 10 5 3 1 3
output:
5 3 4 2 1
result:
ok OK!
Test #2:
score: 0
Accepted
time: 1ms
memory: 5468kb
input:
5 5 20 5 3 3 3 3
output:
impossible
result:
ok OK!
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5572kb
input:
5 10 20 6 1 9 3 2
output:
impossible
result:
wrong answer Contestant printed 'impossible', but an answer existed.