# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743485 | drkarlicio2107 | Dijamant (COI16_dijament) | C++14 | 402 ms | 4712 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;
map <string, int> m;
int ind=1;
vector <string> ev;
const int OFF=1010;
bitset <OFF> l [1010];
bitset <OFF> pom;
int ko [1010][1010];
vector < int > pom2;
int main(){
int n; cin >> n;
for (int i=0; i<n+1; i++){
string s;
getline (cin, s);
ev.clear ();
if (i==0) continue;
string tre="";
for (int j=0; j<s.size(); j++){
if (s [j]==' '){
if (tre!=":" && tre!=";") ev.push_back (tre);
tre="";
}
else tre+=s [j];
}
if (m [ev [0]]){
cout << "greska\n";
continue;
}
int g=0; pom2.clear ();
for (int j=1; j<ev.size(); j++){
if (m [ev [j]]==0){
l [ind]=0;
cout << "greska\n"; g=1;
break;
}
pom2.push_back (m [ev [j]]);
l [ind]=(l [ind] | l [m [ev [j]]]);
l [ind][m [ev [j]]]=1;
}
if (g) continue;
pom=0; int br=1;
sort (pom2.begin(), pom2.end()); reverse (pom2.begin(), pom2.end());
if (pom2.size()>0) pom=l [pom2 [0]];
for (int j=1; j<pom2.size(); j++){
int x=pom2 [j];
if (pom [x]==1) continue;
//cout << l [x] << '\n';
pom = (pom & l [x]); br++;
}
if (pom!=0 && br>1){
cout << "greska\n";
l [ind]=0;
continue;
}
cout << "ok\n";
m [ev [0]]=ind; ind++;
//cout << ind << " " << l [ind] << endl;
}
}
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... |