Submission #734606

#TimeUsernameProblemLanguageResultExecution timeMemory
734606rahidilbayramliAlias (COCI21_alias)C++17
60 / 70
1028 ms8552 KiB
#include<bits/stdc++.h> #define ll long long #define vl vector<ll> #define sl set<ll> #define all(v) v.begin(), v.end() #define f first #define s second #define pb push_back #define pll pair<ll, ll> #define pii pair<int, int> #define tests while(t--) using namespace std; const ll sz = 1010; vector<vector<ll>>graph(sz, vector<ll>(sz, 1e15)); ll n, m, i, j; int main() { set<string>st; map<string, ll>mp; string a, b; ll n, m, i, j, k, l, c, x, y, q; cin >> n >> m; for(i = 0; i < m; i++) { cin >> a >> b >> c; l = st.size(); st.insert(a); if(st.size() != l) mp[a] = st.size(); l = st.size(); st.insert(b); if(st.size() != l) mp[b] = st.size(); x = mp[a]; y = mp[b]; c = min(c, graph[x][y]); graph[x][y] = c; } for(i = 1; i <= n; i++) graph[i][i] = 0; for(k = 1; k <= n; k++) { for(i = 1; i <= n; i++) { for(j = 1; j <= n; j++) graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]); } } cin >> q; while(q--) { cin >> a >> b; x = mp[a], y = mp[b]; if(graph[x][y] == 1e15) cout << "Roger\n"; else cout << graph[x][y] << "\n"; } }

Compilation message (stderr)

alias.cpp: In function 'int main()':
alias.cpp:28:22: warning: comparison of integer expressions of different signedness: 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   28 |         if(st.size() != l)    mp[a] = st.size();
      |            ~~~~~~~~~~^~~~
alias.cpp:31:22: warning: comparison of integer expressions of different signedness: 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   31 |         if(st.size() != l)    mp[b] = st.size();
      |            ~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...