Submission #1237801

#TimeUsernameProblemLanguageResultExecution timeMemory
1237801GeforgsCheap flights (LMIO18_pigus_skrydziai)C11
Compilation error
0 ms0 KiB
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <bitset>
#include <string>
#include <cstring>
#include <iterator>
#include <random>
#define ll long long
#define ld long double
#define inf (ll)(2*1e18)
#define sort(a) sort(a.begin(), a.end())
#define reverse(a) reverse(a.begin(), a.end())
#define pb push_back
#define endl "\n"
using namespace std;

void solve(){
    ll n, m, i, x, y, w, res=0, cnt;
    cin>>n>>m;
    vector<map<ll, ll>> a(n);
    vector<set<pair<ll, ll>>> b(n);
    for(i=0;i<m;++i){
        cin>>x>>y>>w;
        --x;
        --y;
        a[x][y] = w;
        a[y][x] = w;
        b[x].insert({w, y});
        b[y].insert({w, x});
    }
    for(i=0;i<n;++i){
        cnt = 0;
        for(auto el: a[i]){
            cnt += el.second;
        }
        res = max(res, cnt);
        cnt = 0;
        if(b[i].size() > 2){
            x = b[i].rbegin()->second;
            b[i].erase(*b[i].rbegin());
            y = b[i].rbegin()->second;
            cnt = a[i][x] + a[i][y] + a[x][y];
        }
        res = max(res, cnt);
    }
    cout<<res<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    srand(time(nullptr));
    ll t=1;
//    cin>>t;
    for(;t>0;--t){
        solve();
    }
    return 0;
}

Compilation message (stderr)

pigus_skrydziai.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.