# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
123639 | sams | Dijamant (COI16_dijament) | C++14 | 1996 ms | 8708 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3+10;
int n, N;
int nd, mk[maxn][maxn];
map<string, int> conv;
int main()
{
cin >> n;
N = n;
while(N--)
{
string c, pt;
cin >> c >> pt;
set<string> II;
vector<int> g;
while(true)
{
string ss;
cin >> ss;
if(ss == ";") break;
II.insert(ss);
}
if(conv.find(c) != conv.end())
{
cout << "greska\n";
continue;
}
int ok = 0;
conv[c] = ++nd;
for(auto ii: II)
{
if(conv.find(ii) == conv.end())
{
ok = 1;
break;
}
g.push_back(conv[ii]);
}
if(ok)
{
conv.erase(c);
nd--;
cout << "greska\n";
continue;
}
for(int i = 0 ; i < g.size() ; ++i)
{
for(int j = i+1 ; j < g.size() ; ++j)
{
int a = g[i], b = g[j];
if(mk[a][b] == 1 || mk[b][a] == 1) continue;
for(int k = 1 ; k < nd ; ++k)
{
if(mk[a][k] == 1 && mk[b][k] == 1)
{
ok = 1;
break;
}
}
}
if(ok) break;
}
if(ok)
{
nd--;
conv.erase(c);
cout << "greska\n";
continue;
}
for(int u: g)
{
mk[nd][u] = 1;
for(int i = 1 ; i < nd ; ++i)
if(mk[u][i]) mk[nd][i] = 1;
}
cout << "ok\n";
/*for(int i = 1 ; i <= nd ;++i)
{
for(int j = 1 ; j <= nd ; ++j)
{
cout << mk[i][j] << " \n"[j == nd];
}
}*/
}
}
컴파일 시 표준 에러 (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... |