# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120751 | vjudge1 | KOVANICE (COI15_kovanice) | C++17 | 635 ms | 5160 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;
# define int long long
void solve()
{
vector < pair < int , int > > comp;
int n, m, v;
cin >> n >> m >> v;
vector < int > chk(m, 0);
for(int i = 0; i < v; i++)
{
int a, b;
char c;
cin >> a >> c >> b;
if(c == '=')
comp.push_back({a, b});
if(c == '>')
{
chk[a] = 2;
chk[b] = 1;
}
else if(c == '<')
{
chk[a] = 1;
chk[b] = 2;
}
}
for(int bit = 0; bit < 100; bit++)
{
for(int i = 0; i < comp.size(); i++)
{
if(chk[comp[i].first] == 0)
chk[comp[i].first] = chk[comp[i].second];
else
chk[comp[i].second] = chk[comp[i].first];
}
}
for(int i = 1; i <= m; i++)
{
if(chk[i] == 0)
cout << '?' << endl;
else
{
cout << "K" << chk[i] << endl;
}
}
}
signed main()
{
int tt = 1;
// cin >> tt;
while(tt--)
solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |