Submission #495869

#TimeUsernameProblemLanguageResultExecution timeMemory
495869NimbostratusACM (COCI19_acm)C++17
0 / 50
25 ms31992 KiB
#include "bits/stdc++.h" #define endl '\n' #define fi first #define se second constexpr int maxn = 1005; constexpr int inf = 2e9; constexpr int mod = 1e9 + 7; using namespace std; using lint = long long; using pii = pair<int, int>; int n, m; string sub[maxn][maxn]; struct score { int penalty = 0; bool ourteam = false; string name; void add(string& s, int idx) { if(s[0] == '-' || s[0] == '?' && ourteam && sub[n + 1][idx][0] != '+') { penalty += 20000; return; } string hour = s.substr(3, 4); string min = s.substr(6, 7); string sec = s.substr(9, 10); penalty += stoi(hour) * 3600; penalty += stoi(min) * 60; penalty += stoi(sec); penalty += (s[1] - '0') * 1200; } friend bool operator<(score& x, score& y) { if(x.penalty < y.penalty) return true; if(x.penalty > y.penalty) return false; return x.name < y.name; } }; score a[maxn]; signed main() { #ifdef Local freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; for(int i = 1; i <= n; i++) { cin >> a[i].name; a[i].ourteam = a[i].name == "NijeZivotJedanACM"; for(int j = 1; j <= m; j++) cin >> sub[i][j]; } string tmp; cin >> tmp; for(int i = 1; i <= m; i++) cin >> sub[n + 1][i]; for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) a[i].add(sub[i][j], j); sort(a + 1, a + n + 1); for(int i = 1; i <= n; i++) if(a[i].ourteam) { cout << i << endl; return 0; } }

Compilation message (stderr)

acm.cpp: In member function 'void score::add(std::string&, int)':
acm.cpp:20:44: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   20 |   if(s[0] == '-' || s[0] == '?' && ourteam && sub[n + 1][idx][0] != '+') {
#Verdict Execution timeMemoryGrader output
Fetching results...