# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
414952 |
2021-05-31T10:59:35 Z |
Pro_ktmr |
Naan (JOI19_naan) |
C++17 |
|
0 ms |
0 KB |
#include<iostream>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define INT boost_multiprecision::int128_t
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };
int N, L;
ll V[2000][2000];
ll a[2000][2000], b[2000][2000];
bool used[2000] ={};
signed main(){
cin >> N >> L;
rep(i, N){
rep(j, L){
cin >> V[i][j];
}
}
rep(i, N){
ll AllSum = 0;
rep(j, L) AllSum += V[i][j];
ll sum = 0;
int idx = 0;
rep(j, L){
while(sum*N+V[i][j]*N >= AllSum*(idx+1)){
a[i][idx] = AllSum*(idx+1) - sum*N + V[i][j]*N*j;
b[i][idx] = V[i][j]*N;
idx++;
}
sum += V[i][j];
}
}
/*
rep(i, N){
rep(j, N-1){
cout << a[i][j] << "/" << b[i][j] << " ";
}
cout << endl;
}*/
vector<int> ans;
rep(i, N){
INT A = L+1;
INT B = 1;
int idx = -1;
rep(j, N){
if(used[j]) continue;
if(A*(INT)b[j][i] > B*(INT)a[j][i]){
A = a[j][i];
B = b[j][i];
idx = j;
}
}
used[idx] = true;
ans.pb(idx+1);
if(i != N-1) cout << A << " " << B << endl;
}
rep(i, N){
if(i != 0) cout << " ";
cout << ans[i];
}
cout << endl;
}
Compilation message
naan.cpp:3:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
3 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.