제출 #541985

#제출 시각아이디문제언어결과실행 시간메모리
541985OlympiaKarte (COCI15_karte)C++17
15 / 50
1 ms324 KiB
#include <vector> #include <algorithm> #include <iostream> #include <set> #include <cmath> #include <map> #include <random> #include <cassert> #include <ctime> #include <cstdlib> #include <limits.h> #include <queue> using namespace std; int main() { //freopen("inp.txt", "r", stdin); ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; map<int,set<char>> cnt; int ans = 0; for (int i = 0; i < s.length(); i += 3) { if (s[i] == 'P') { cnt[0].insert(s[i + 2]); } else if (s[i] == 'K') { cnt[1].insert(s[i + 2]); } else if (s[i] == 'H') { cnt[2].insert(s[i + 2]); } else if (s[i] == 'T') { cnt[3].insert(s[i + 2]); } } ans = 0; for (int i = 0; i < 4; i++) { //cout << 13 - cnt[i].size() << ' '; ans += cnt[i].size(); } if (ans != s.length()/3) { cout << "GRESKA\n"; return 0; } for (int i = 0; i < 4; i++) { cout << 13 - cnt[i].size() << ' '; // ans += cnt[i].size(); } }

컴파일 시 표준 에러 (stderr) 메시지

karte.cpp: In function 'int main()':
karte.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < s.length(); i += 3) {
      |                     ~~^~~~~~~~~~~~
karte.cpp:39:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if (ans != s.length()/3) {
      |         ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...