Submission #1184314

#TimeUsernameProblemLanguageResultExecution timeMemory
1184314InvMODKarte (COCI15_karte)C++17
50 / 50
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define gcd __gcd #define sz(v) (int) v.size() #define pb push_back #define pi pair<int,int> #define all(v) (v).begin(), (v).end() #define compact(v) (v).erase(unique(all(v)), (v).end()) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define ROF(i, a, b) for(int i = (a); i >= (b); i--) #define dbg(x) "[" #x " = " << (x) << "]" ///#define int long long using ll = long long; using ld = long double; using ull = unsigned long long; template<typename T> bool ckmx(T& a, const T& b){if(a < b) return a = b, true; return false;} template<typename T> bool ckmn(T& a, const T& b){if(a > b) return a = b, true; return false;} const int N = 2e5+5; const ll MOD = 1e9+7; const ll INF = 1e18; void solve() { string s; cin >> s; if(sz(s) > 156) return cout << "GRESKA\n", void(); map<string, int> cnt; map<char, int> cnt_t; cnt_t['P'] = 13, cnt_t['K'] = 13, cnt_t['H'] = 13, cnt_t['T'] = 13; for(int i = 0; i < sz(s); i += 3){ string t = s.substr(i, 3); cnt[t]++; if(cnt[t] > 1){ cout << "GRESKA\n"; return; } cnt_t[t[0]]--; } cout << cnt_t['P'] <<" " << cnt_t['K'] <<" " << cnt_t['H'] <<" " << cnt_t['T'] << "\n"; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define name "InvMOD" if(fopen(name".INP", "r")){ freopen(name".INP","r",stdin); freopen(name".OUT","w",stdout); } int t = 1; //cin >> t; while(t--) solve(); return 0; }

Compilation message (stderr)

karte.cpp: In function 'int main()':
karte.cpp:63:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |         freopen(name".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
karte.cpp:64:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |         freopen(name".OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...