제출 #1020228

#제출 시각아이디문제언어결과실행 시간메모리
1020228nguyen31hoang08minh2003Karte (COCI15_karte)C++17
50 / 50
1 ms508 KiB
#include <set> #include <map> #include <list> #include <ctime> #include <cmath> #include <queue> #include <deque> #include <stack> #include <math.h> #include <bitset> #include <vector> #include <string> #include <cstdio> #include <cctype> #include <numeric> #include <fstream> #include <sstream> #include <cstdlib> #include <iomanip> #include <cassert> #include <cstring> #include <stdio.h> #include <typeinfo> #include <stdint.h> #include <string.h> #include <iterator> #include <iostream> #include <algorithm> #include <strings.h> #include <functional> #include <unordered_set> #include <unordered_map> #define fore(i, a, b) for (int i = (a), i##_last = (b); i < i##_last; ++i) #define fort(i, a, b) for (int i = (a), i##_last = (b); i <= i##_last; ++i) #define ford(i, a, b) for (int i = (a), i##_last = (b); i >= i##_last; --i) #define fi first #define se second #define pb push_back #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using ld = long double; template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;}; template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;}; typedef unsigned long long ull; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef vector<vii> vvii; const string SUITS = "PKHT"; signed main() { unordered_set<int> numbers[300]; int cardCount = 0, length, f[300]{}; string S; #ifdef LOCAL freopen("input.INP", "r", stdin); #endif // LOCAL cin.tie(0) -> sync_with_stdio(0); cout.tie(0); cin >> S; length = S.size(); for (int i = 0; i < length; i += 3) { numbers[S[i]].insert((S[i + 1] - '0') * 10 + S[i + 2] - '0'); ++f[S[i]]; if (f[S[i]] != numbers[S[i]].size()) { puts("GRESKA"); return 0; } } for (const char &suit : SUITS) cout << 13 - f[suit] << ' '; cout << '\n'; return 0; }

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

karte.cpp: In function 'int main()':
karte.cpp:76:21: warning: array subscript has type 'char' [-Wchar-subscripts]
   76 |         numbers[S[i]].insert((S[i + 1] - '0') * 10 + S[i + 2] - '0');
      |                     ^
karte.cpp:77:17: warning: array subscript has type 'char' [-Wchar-subscripts]
   77 |         ++f[S[i]];
      |                 ^
karte.cpp:78:19: warning: array subscript has type 'char' [-Wchar-subscripts]
   78 |         if (f[S[i]] != numbers[S[i]].size()) {
      |                   ^
karte.cpp:78:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   78 |         if (f[S[i]] != numbers[S[i]].size()) {
      |                                    ^
karte.cpp:78:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::unordered_set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |         if (f[S[i]] != numbers[S[i]].size()) {
      |             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
karte.cpp:85:24: warning: array subscript has type 'char' [-Wchar-subscripts]
   85 |         cout << 13 - f[suit] << ' ';
      |                        ^~~~
karte.cpp:61:9: warning: unused variable 'cardCount' [-Wunused-variable]
   61 |     int cardCount = 0, length, f[300]{};
      |         ^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...