| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 494333 | ktkerem | Alias (COCI21_alias) | C++17 | 149 ms | 576 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll _i=0;
#define ffn(x) _i=x
#define llll pair<ll , ll>
#define stitr set<llll>::iterator
#define fora(y,x) for(ll y=_i;x>y;y++)
#define pb push_back
#define pf push_front
#define debu cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e13 + 7; 
const ll ous=1e6 + 5;
const ll dx[4] = {1 , -1 , 0 , 0} , dy[4] = {0,0,-1,1};
void solve(){
    ll n , m;cin >> n >> m;
    map<string , vector<pair<ll , string>>> adj;
    fora(i,m){
        string h  , y;ll x;cin >> h >> y >> x;
        adj[h].pb({x , y});
    }
    ll q;cin >> q;
    while(q--){
        map<string , ll> vis;
        string src , trg;
        cin >> src >> trg;
        priority_queue<pair<ll , string> , vector<pair<ll , string>> , greater<pair<ll , string>>> pq;
        pq.push({0 , src});
        ll kd = 0;
        while(!pq.empty()){
            ll a = pq.top().fi;
            string sa = pq.top().sec;
            pq.pop();
            if(vis[sa] == 1){
                continue;
            }
            vis[sa] = 1;
            //cout << sa << "\n";
            if(sa == trg){
                cout << a << "\n";
                kd = 1;
                break;
            }
            for(auto j:adj[sa]){
                if(vis[j.sec] == 0){
                    pq.push({j.fi + a , j.sec});
                }
            }
        }
        if(kd == 0){
            cout << "Roger\n";
        }
    }
    return;
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t=1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0; 
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
