Submission #153845

#TimeUsernameProblemLanguageResultExecution timeMemory
153845Ruxandra985Karte (COCI15_karte)C++14
50 / 50
2 ms504 KiB
#include <cstdio> #include <set> using namespace std; set <int> s[4]; int main() { FILE *fin = stdin; FILE *fout = stdout; int nr; char c; c = fgetc (fin); while (c=='P' || c =='K' || c == 'H' || c =='T'){ nr = (fgetc(fin)-'0') * 10 + (fgetc(fin)-'0'); if (c == 'P'){ if (s[0].find(nr) != s[0].end()){ fprintf (fout,"GRESKA"); return 0; } s[0].insert(nr); } else if (c == 'K'){ if (s[1].find(nr) != s[1].end()){ fprintf (fout,"GRESKA"); return 0; } s[1].insert(nr); } else if (c == 'H'){ if (s[2].find(nr) != s[2].end()){ fprintf (fout,"GRESKA"); return 0; } s[2].insert(nr); } else if (c == 'T'){ if (s[3].find(nr) != s[3].end()){ fprintf (fout,"GRESKA"); return 0; } s[3].insert(nr); } c = fgetc(fin); } fprintf (fout,"%d %d %d %d" , 13 - s[0].size() , 13 - s[1].size() , 13 - s[2].size() , 13 - s[3].size() ); return 0; }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fout,"%d %d %d %d" , 13 - s[0].size() , 13 - s[1].size() , 13 - s[2].size() , 13 - s[3].size() );
                                   ~~~~~~~~~~~~~~~~                                                          ^
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 4 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 5 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
karte.cpp:44:109: warning: format '%d' expects argument of type 'int', but argument 6 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
#Verdict Execution timeMemoryGrader output
Fetching results...