Submission #39802186
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const char newl = '\n';
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=Int>
vector<T> read(size_t n){
vector<T> ts(n);
for(size_t i=0;i<n;i++) cin>>ts[i];
return ts;
}
template<typename T>
void space(const vector<T> &vs){
for(size_t i=0;i<vs.size();i++){
if(i) cout<<' ';
cout<<vs[i];
}
cout<<'\n';
}
//INSERT ABOVE HERE
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
Int n;
cin>>n;
vector<Int> ss(n),ps(n);
for(Int i=0;i<n;i++) cin>>ss[i]>>ps[i];
vector<Int> ord(n);
iota(ord.begin(),ord.end(),0);
auto calc=[&](Int i,Int j){
return 100*ps[i]*ss[i]+ps[i]*ps[j]*ss[j];
};
auto cmp=[&](Int i,Int j){
return calc(i,j)>calc(j,i);
};
sort(ord.begin(),ord.end(),cmp);
for(auto&&x:ord) x++;
space(ord);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Best Strategy |
| User | beet |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 1049 Byte |
| Status | AC |
| Exec Time | 79 ms |
| Memory | 7880 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 00-sample-003.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 11 ms | 3444 KiB |
| 00-sample-002.txt | AC | 2 ms | 3536 KiB |
| 00-sample-003.txt | AC | 2 ms | 3500 KiB |
| 01-001.txt | AC | 2 ms | 3532 KiB |
| 01-002.txt | AC | 19 ms | 3944 KiB |
| 01-003.txt | AC | 39 ms | 5260 KiB |
| 01-004.txt | AC | 61 ms | 6800 KiB |
| 01-005.txt | AC | 76 ms | 7852 KiB |
| 01-006.txt | AC | 78 ms | 7804 KiB |
| 01-007.txt | AC | 78 ms | 7832 KiB |
| 01-008.txt | AC | 36 ms | 5036 KiB |
| 01-009.txt | AC | 36 ms | 4988 KiB |
| 01-010.txt | AC | 31 ms | 4712 KiB |
| 01-011.txt | AC | 78 ms | 7828 KiB |
| 01-012.txt | AC | 79 ms | 7788 KiB |
| 01-013.txt | AC | 78 ms | 7880 KiB |
| 01-014.txt | AC | 55 ms | 7764 KiB |
| 01-015.txt | AC | 53 ms | 7764 KiB |
| 01-016.txt | AC | 55 ms | 7852 KiB |