Submission #495875

#TimeUsernameProblemLanguageResultExecution timeMemory
495875NimbostratusACM (COCI19_acm)C++17
50 / 50
20 ms32020 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((ourteam && sub[n + 1][idx][0] == '-') || (!ourteam && s[0] == '-')) { penalty += 16 * 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]; } cin >> sub[n + 1][1]; 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; } }
#Verdict Execution timeMemoryGrader output
Fetching results...