이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e3+5;
map<string, int> st;
vector<int> G[N];
int main()
{
int n;
cin >> n;
int cur = 0;
for(int i = 0; i < n; i ++)
{
string k;
cin >> k;
string temp; cin >> temp;
bool ok = true;
ok &= (st.count(k) == 0);
while(true)
{
cin >> temp;
if(temp == ";")
break;
if(st.count(temp) == 0)
ok = false;
else
G[cur].push_back(st[temp]);
}
if(ok)
{
int cnt[cur] = {0};
for(int l : G[cur])
for(int j : G[l])
cnt[j]++;
for(int j = 0; j < cur; j++)
if(cnt[j] > 1)
ok = false;
if(ok)
{
st[k] = cur++;
cout << "ok\n";
}
else
cout << "greska\n";
}
else
cout << "greska\n";
}
return 0;
}
# | 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... |