Submission #1130870

#TimeUsernameProblemLanguageResultExecution timeMemory
1130870nikolashami여행하는 상인 (APIO17_merchant)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int N=104,inf=(1ll<<62)-62; int og[N][N],tg[N][N],kg[N][N],bs[N][10*N][2],n,m,k; bool ss(){ for(int i=0;i<n;++i)if(kg[i][i]<=0)return 1; return 0; } void fw(int aa[N][N]){ for(int kk=0;kk<n;++kk){ for(int i=0;i<n;++i){ for(int j=0;j<n;++j) aa[i][j]=min(aa[i][j],aa[i][kk]+aa[kk][j]); } } } bool chk(int x){ for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ int sc==og[i][j]*x; if(sc<0)sc=inf; kg[i][j]=sc-tg[i][j]; } } fw(kg); return(ss()); } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cin>>n>>m>>k; for(int i=0;i<n;++i) fill(og[i],og[i]+n,inf); for(int i=0;i<n;++i){ for(int j=0;j<k;++j) cin>>bs[i][j][0]>>bs[i][j][1]; } for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ for(int kk=0;kk<k;++kk) if(bs[j][kk][1]!=-1&&bs[i][kk][0]!=-1) tg[i][j]=max(tg[i][j],bs[j][kk][1]-bs[i][kk][0]); } } for(int i=0,u,v,w;i<m;++i){ cin>>u>>v>>w; --u,--v; og[u][v]=w; } fw(og); int l=1,r=l+1e9,ans=0; while(l<=r){ int mid=(l+r)/2; if(chk(mid)){ l=mid+1; ans=mid; }else r=mid-1; } cout<<ans; }

Compilation message (stderr)

merchant.cpp: In function 'bool chk(long long int)':
merchant.cpp:26:31: error: expected initializer before '==' token
   26 |                         int sc==og[i][j]*x;
      |                               ^~
merchant.cpp:27:28: error: 'sc' was not declared in this scope; did you mean 'ss'?
   27 |                         if(sc<0)sc=inf;
      |                            ^~
      |                            ss
merchant.cpp:28:34: error: 'sc' was not declared in this scope; did you mean 'ss'?
   28 |                         kg[i][j]=sc-tg[i][j];
      |                                  ^~
      |                                  ss