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 FOR(i, a, b) for (int i = a; i < (int) b; i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = a; i >= (int) b; i--)
#define R0F(i, a) ROF(i, a, 0)
#define GO(i, a) for (auto i : a)
#define f first
#define s second
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int ms[] = {+31, +29, +31, 30, +31, +30, +31, +31, +30, +31, +30, +31};
map<string, int> node;
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
F0R (i, n) {
string w;
cin >> w >> ws;
string comando;
getline (cin, comando);
istringstream token (comando);
string dependencia;
// We are checking condition 1
if (node.find(w) != node.end()) {
cout << "greska" << '\n';
continue;
}
// We are checking condition 2
bool all_exist = true;
while (token >> dependencia) {
if (dependencia == ":" || dependencia == ";") continue;
if (node.find(dependencia) == node.end()) {
all_exist = false;
cout << "greska" << '\n';
break;
}
}
if (all_exist == false) continue;
cout << "ok" << '\n';
node[w] = i;
}
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... |