Submission #743628

#TimeUsernameProblemLanguageResultExecution timeMemory
743628lukadupliDijamant (COI16_dijament)C++14
56 / 100
2089 ms420 KiB
#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; bs[cnt] = b; return 1; } 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; vector<string> dads; 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 (stderr)

dijament.cpp: In function 'bool add(std::string&, std::vector<std::__cxx11::basic_string<char> >&)':
dijament.cpp:16:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i = 0; i < dads.size(); i++){
      |                    ~~^~~~~~~~~~~~~
dijament.cpp:17:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int j = i + 1; j < dads.size(); j++){
      |                            ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...