Submission #52312

#TimeUsernameProblemLanguageResultExecution timeMemory
52312MilkiDijamant (COI16_dijament)C++14
13 / 100
302 ms3080 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = 0; i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define TRACE(x) cerr << #x << " = " << x << endl #define _ << " " << typedef long long ll; typedef pair<int, int> point; const int MAXN = 1e3 + 5; int n; map<string, int> id; vector <int> parents[MAXN]; bool bio[MAXN]; int curr; bool check(string &name, vector <string> &par){ if(id[name] != 0) return 0; for(auto it : par){ if(id[it] == 0) return 0; } vector <int> parId; REP(i, (int)par.size()){ parId.push_back(id[par[i]]); } sort(parId.rbegin(), parId.rend()); memset(bio, 0, sizeof(bio)); for(auto it : parId){ if(bio[it]) continue; for(auto p : parents[it]){ if(bio[p]) return 0; bio[p] = 1; } } id[name] = ++curr; for(auto it : parId) bio[it] = 1; FOR(i, 1, curr) if(bio[i]) parents[curr].push_back(i); } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; REP(i, n){ string name, tmp; vector<string> v; cin >> name >> tmp; cin >> tmp; while(tmp != ";"){ v.push_back(tmp); cin >> tmp; } if(check(name, v)) cout << "ok\n"; else cout << "greska\n"; } }

Compilation message (stderr)

dijament.cpp: In function 'bool check(std::__cxx11::string&, std::vector<std::__cxx11::basic_string<char> >&)':
dijament.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...