# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
873363 | ofrankel | Naan (JOI19_naan) | C++17 | 672 ms | 163676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll __int128_t
int n,l;
vector<vector<int>>v;
ll gc(ll a,ll b){
if(!b)return a;
return gc(b,a%b);
}
class frac{
public:
ll a,b;
frac(ll _a,ll _b):a(_a),b(_b){reduce();}
frac(ll x):a(x),b(1){}
void reduce(){if(ll g=gc(a,b)){a/=g;b/=g;}}
bool operator <(const frac& other){return a*other.b<other.a*b;}
frac operator +( const frac& other){return frac(a*other.b+b*other.a,b*other.b);}
};
pair<vector<pair<ll,ll>>,vector<int>> solve(int N,int L,vector<vector<int>>V){
n=N;l=L;v=move(V);
vector<int>was(n);
vector<int>p(n);
vector<pair<ll,ll>>t(n-1);
vector<ll>s(n);for(int i=0;n>i;++i)for(int j:v[i])s[i]+=j;
vector<vector<frac>>g(n,vector<frac>(n-1,l));
for(int i=0;n>i;++i){
int ind=0;ll kam=0;
for(int j=0;n>j+1;++j){
if(v[i][ind]*n>=kam+s[i]){
g[i][j]=frac((ll)v[i][ind]*n*ind+kam+s[i],v[i][ind]*n);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |