Submission #1120530

#TimeUsernameProblemLanguageResultExecution timeMemory
1120530vjudge1KOVANICE (COI15_kovanice)C++17
0 / 100
313 ms48176 KiB
#include <bits/stdc++.h> using namespace std; const int sz = 3e5 + 5; vector<int> az[sz],cox[sz],ber[sz]; vector<int> ans(sz,-1); vector<bool> vis(sz,0); void dfs(int a,int b){ vis[a] = 1; ans[a] = b; for(auto &i : az[a]){ if(!vis[i]){ dfs(i,1); } } for(auto &i : ber[a]){ if(!vis[i]){ dfs(i,b); } } for(auto &i : cox[a]){ if(!vis[i]){ dfs(i,2); } } } signed main(){ int n,m,k; cin >> n>> m >> k; vector<int> iki,bir; string s; while(k--){ cin >> s; int a=0,b=0; char c='.'; for(int i=0;i<s.size();++i){ if(s[i] >= '0' && s[i] <= '9'){ if(c == '.')a = a * 10 + (s[i] - '0'); else b = b * 10 + (s[i] - '0'); }else{ c = s[i]; } } if(c == '='){ ber[a].push_back(b); ber[b].push_back(a); }else if(c == '<'){ iki.push_back(b); bir.push_back(a); cox[a].push_back(b); az[b].push_back(a); }else{ iki.push_back(a); bir.push_back(b); cox[b].push_back(a); az[a].push_back(b); } } for(int _=0;_<5;++_){ for(auto &temp : cox){ for(auto &i : temp){ if(!vis[i])dfs(i,2); } } } for(int i=1;i<=m;++i){ if(ans[i] == -1){ cout << "?"; }else{ cout << "R" << ans[i]; } cout << '\n'; } }

Compilation message (stderr)

kovanice.cpp: In function 'int main()':
kovanice.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int i=0;i<s.size();++i){
      |                     ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...