Submission #650103

#TimeUsernameProblemLanguageResultExecution timeMemory
650103berrKarte (COCI15_karte)C++17
50 / 50
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); /*#ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif */ string s; cin>>s; int f=s.size()/3; set<string> q[4]; for(int i=0; i<s.size(); i+=3) { string h=s.substr(i+1, 2); if(s[i]=='P') q[0].insert(h); else if(s[i]=='K') q[1].insert(h); else if(s[i]=='H') q[2].insert(h); else q[3].insert(h); } if((s.size()/3)!=(q[3].size()+q[2].size()+q[1].size()+q[0].size())) { cout<<"GRESKA"; } else { for(int i=0; i<4; i++) { cout<<13-q[i].size()<<" "; } } }

Compilation message (stderr)

karte.cpp: In function 'int32_t main()':
karte.cpp:23:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i=0; i<s.size(); i+=3)
      |                  ~^~~~~~~~~
karte.cpp:20:9: warning: unused variable 'f' [-Wunused-variable]
   20 |     int f=s.size()/3;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...