QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#525668 | #676. Travelling Merchant | Rafi22# | 0 | 0ms | 0kb | C++17 | 2.0kb | 2024-08-20 20:11:53 | 2024-08-20 20:11:53 |
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif
#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;
const int N=107,K=1007;
int bx[N][K],sx[N][K];
int d[N][N];
int C[N][N];
ll D[N][N];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m,k;
cin>>n>>m>>k;
FOR(i,1,n) FOR(j,1,k) cin>>bx[i][j]>>sx[i][j];
FOR(i,1,n)
{
FOR(j,1,n)
{
if(i==j) continue;
d[i][j]=inf;
FOR(l,1,k) if(sx[j][l]!=-1&&bx[i][l]!=-1) C[i][j]=max(C[i][j],sx[j][l]-bx[i][l]);
}
}
FOR(i,1,m)
{
int a,b,c;
cin>>a>>b>>c;
d[a][b]=min(d[a][b],c);
}
FOR(t,1,n) FOR(i,1,n) FOR(j,1,n) d[i][j]=min(d[i][j],d[i][t]+d[t][j]);
ll ans=0;
FOR(i,1,n) ans=max(ans,C[1][i]/(d[1][i]+d[i][1]));
cout<<ans<<endl;
/*int l=1,r=1000000000,ans=0;
while(l<=r)
{
int sr=(l+r)/2;
FOR(i,1,n)
{
FOR(j,1,n)
{
if(i==j) D[i][j]=0;
else
{
if(d[i][j]==inf) D[i][j]=-infl;
else D[i][j]=(ll)C[i][j]-(ll)sr*(ll)d[i][j];
}
}
}
bool ok=0;
FOR(t,1,n) FOR(i,1,n) FOR(j,1,n) D[i][j]=max(D[i][j],D[i][t]+D[t][j]);
FOR(i,1,n) FOR(j,1,n) if(i!=j) if(D[i][j]+D[j][i]>=0) ok=1;
if(ok)
{
ans=sr;
l=sr+1;
}
else r=sr-1;
}
cout<<ans<<endl;*/
return 0;
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
100 181 1000 553730496 158361961 892706912 178296397 743382683 297380306 641674485 99624440 917350062 18856036 844421978 187895310 648680590 312745394 560991872 402321479 712754581 166489560 776432653 57402415 554268728 511597509 861517186 541462029 843246768 457630601 923371196 521104850 557772066 ...
output:
result:
Subtask #2:
score: 0
Runtime Error
Test #14:
score: 0
Runtime Error
input:
50 50 20 1000000000 94476 1000000000 75837 1000000000 27079 1000000000 129004 1000000000 100830 1000000000 98560 1000000000 99302 1000000000 65993 30410 1 1000000000 66183 1000000000 89148 1000000000 21236 1000000000 11935 1000000000 53895 1000000000 126490 1000000000 104741 1000000000 78615 1000000...
output:
result:
Subtask #3:
score: 0
Runtime Error
Test #37:
score: 0
Runtime Error
input:
100 243 1000 969713863 380451398 977287381 546839551 578242281 267067963 834635238 316438277 806980243 189648353 779415475 453867771 741678190 352485450 473763928 190177433 687118672 377243148 644333594 197290749 949048287 436673078 690006797 180711316 714366028 387342721 980055654 198167471 8873988...
output:
result:
Subtask #4:
score: 0
Skipped
Dependency #1:
0%