| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 258785 | uacoder123 | Cheap flights (LMIO18_pigus_skrydziai) | C++14 | 972 ms | 64736 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <ii,lli> iii;
typedef vector <lli> vi;
map<ii,int> ma;
vector<ii> al[300001];
int main()
{
int n,m;
cin>>n>>m;
for(int i=0;i<m;++i)
{
int f,s,w;
cin>>f>>s>>w;
al[f].pb(mp(w,s));
al[s].pb(mp(w,f));
ma[mp(f,s)]=w;
ma[mp(s,f)]=w;
}
lli ans=0;
for(int i=1;i<=n;++i)
{
sort(all(al[i]));
lli s=0;
for(int j=0;j<al[i].size();++j)
s+=al[i][j].F;
if(al[i].size()>1&&ma.find(mp(al[i][0].F,al[i][1].F))!=ma.end())
s=max(s,al[i][0].F+al[i][1].F+ma[mp(al[i][0].F,al[i][1].F)]);
ans=max(ans,s);
}
cout<<ans<<endl;
return(0);
} 컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
