Submission #743485

#TimeUsernameProblemLanguageResultExecution timeMemory
743485drkarlicio2107Dijamant (COI16_dijament)C++14
27 / 100
402 ms4712 KiB
#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)

dijament.cpp: In function 'int main()':
dijament.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for (int j=0; j<s.size(); j++){
      |                 ~^~~~~~~~~
dijament.cpp:31:18: 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]
   31 |   for (int j=1; j<ev.size(); j++){
      |                 ~^~~~~~~~~~
dijament.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   for (int j=1; j<pom2.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...