Submission #376747

#TimeUsernameProblemLanguageResultExecution timeMemory
376747marat0210Karte (COCI15_karte)C++14
50 / 50
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >>s; set <string> st; long long cnt = 0; for (int i = 0; i < s.size(); i += 3) { string k = s.substr(i, 3); st.insert(k); cnt++; } if (st.size() == cnt) { long long p = 0, f = 0, h = 0, t = 0; for (int i = 0; i < s.size(); i += 3) { string k = s.substr(i, 3); if (k[0] == 'P') p++; else if (k[0] == 'K') f++; else if (k[0] == 'H') h++; else if (k[0] == 'T') t++; } cout <<13 - p<<" "<<13 - f<<" "<<13 - h<<" "<<13 - t<<endl; } else { cout <<"GRESKA"<<endl; } }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < s.size(); i += 3) {
      |                     ~~^~~~~~~~~~
karte.cpp:16:19: warning: comparison of integer expressions of different signedness: 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   16 |     if (st.size() == cnt) {
      |         ~~~~~~~~~~^~~~~~
karte.cpp:18:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int i = 0; i < s.size(); i += 3) {
      |                         ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...