Submission #919517

#TimeUsernameProblemLanguageResultExecution timeMemory
919517TINKarte (COCI15_karte)C++17
50 / 50
1 ms708 KiB
#include <bits/stdc++.h> using namespace std; #define FNAME "test" #define ERR "GRESKA" string s; bool b[4][13]; void Task() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(9); if (fopen(FNAME".inp","r")) { freopen(FNAME".inp","r",stdin); freopen(FNAME".out","w",stdout); } } void Solve() { //Your Code auto id = [&](char t) -> int { if (t == 'P') return 0; if (t == 'K') return 1; if (t == 'H') return 2; return 3; }; memset(b, false, sizeof(b)); cin >> s; for (int i = 0; i < (int) s.size(); i += 3) { char t = s[i]; int type = id(t); int num = 10 * (s[i + 1] - '0') + (s[i + 2] - '0'); num--; if (b[type][num]) { cout << ERR; return; } b[type][num] = true; } for (int type = 0; type < 4; type++) { int res = 13; for (int num = 0; num < 13; num++) { res -= b[type][num]; } cout << res << " "; } } int main() { Task(); Solve(); cerr << "\nTime run: " << 1000*clock()/CLOCKS_PER_SEC << "ms"; return 37^37; }

Compilation message (stderr)

karte.cpp: In function 'void Task()':
karte.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   freopen(FNAME".inp","r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
karte.cpp:18:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   freopen(FNAME".out","w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...