# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743630 | 2023-05-17T14:54:32 Z | lukadupli | Dijamant (COI16_dijament) | C++14 | 2000 ms | 372 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1005; int n, cnt = 0; map<string, int> mapa; bitset<MAXN> bs[MAXN]; bool add(string& klasa, vector<string>& dads){ if(mapa.find(klasa) != mapa.end()) return 0; for(string& d : dads) if(mapa.find(d) == mapa.end()) return 0; bitset<MAXN> b; for(int i = 0; i < dads.size(); i++){ for(int j = i + 1; j < dads.size(); j++){ int d1 = mapa[dads[i]], d2 = mapa[dads[j]]; if(!bs[d2][d1] && !bs[d1][d2] && (bs[d1] & bs[d2]).count()) return 0; } b |= bs[mapa[dads[i]]]; } mapa[klasa] = ++cnt; b[cnt] = 1; swap(bs[cnt], b); return 1; } vector<string> dads; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 0; i < n; i++){ string k; cin >> k; char c; cin >> c; dads.clear(); string in = ""; while(in != ";"){ cin >> in; dads.push_back(in); } dads.pop_back(); if(add(k, dads)) cout << "ok\n"; else cout << "greska\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 23 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 23 ms | 344 KB | Output is correct |
7 | Correct | 2 ms | 340 KB | Output is correct |
8 | Correct | 0 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 2 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2081 ms | 372 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |