Submission #1322585

#TimeUsernameProblemLanguageResultExecution timeMemory
1322585cubedConstruction Project 2 (JOI24_ho_t2)C++20
0 / 100
1 ms568 KiB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define f first
// #define s second
#define pb(x) push_back(x)
#define int long long


/*
ORDERED SET PDBS

#include <bits/extc++.h>
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
*/

const int MOD = 1e9+7;
const int inf = 1e9;
const int INF = 1e18+20;
const int LOG = 25;

void solve() {
    int n, m;
    cin>>n>>m;

    int s, t, l, k;
    cin>>s>>t>>l>>k;
    s--; t--;

    vector<vector<pair<int, int>>> adj(n);
    bool tt=false;

    for (int i=0; i<m; i++) {
        int u, v, w;
        cin>>u>>v>>w;
        u--; v--;

        if ((u==s && t==v) || (u==t && v==s)) tt=true;
        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
    }

    int ans = adj[s].size() + adj[t].size() +1;
    if (tt) ans--;

    cout<<ans<<endl;
}

bool multi=false;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
  

    int t=1;
    if (multi) cin>>t;
 
    while (t--) solve();
 
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...