Submission #1257535

#TimeUsernameProblemLanguageResultExecution timeMemory
1257535E_rKACM (COCI19_acm)C++20
10 / 50
4 ms6216 KiB
#include <bits/stdc++.h> #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define pb push_back #define ppb pop_back #define fi first #define se second #define sp " " // #define endl "\n" #define mod 1000000007 #define MAXN 200005 #define MAXM 1000006 #define inf 1e18 #define INF 0x3f #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define debug(x) for(auto& a: x) cout << a << " " using namespace std; typedef long long int lo; lo n,m,p,q,k,l,a,b; lo arr[MAXN]; lo len[MAXN]; vector<lo> v[MAXN]; string s; vector<lo> dp; string names[30]; string sorular[1006][40]; pair<lo,lo> score[MAXN]; lo cnt[MAXN]; lo timetoscore(string s){ // cout << s[1] << sp; lo pen = (s[1] - '1') * 1200; lo pentime = (s[4] - '0') * 3600 + ((s[6] - '0') * 600) + ((s[7]-'0')*60) + (s[9]-'0')*10 + s[10]-'0'; // cout << s << sp << pentime << endl; return pen + pentime; } bool cmp(pair<lo,lo> a, pair<lo,lo> b){ if(a.fi == b.fi) return a.se < b.se; return a.fi > b.fi; } void solve(){ cin >> n >> m; for (int i = 0; i < n; ++i) { cin >> names[i]; // cout << names[i] << endl; for (int j = 0; j < m; ++j) { cin >> sorular[i][j]; if(names[i] == "NijeZivotJedanACM"){ continue; } if(sorular[i][j][0] == '-') continue; cnt[i]++; // cout << i << sp; // cout<< sorular[i][j] << sp << timetoscore(sorular[i][j]) << endl; score[i].fi++;; score[i].se += timetoscore(sorular[i][j]); } } string name,benim[m+1]; lo benimscore=0; cin >> name; lo cnt = 0; for (int j = 0; j < m; ++j) { cin >> benim[j]; if(benim[j][0] == '-') continue; if(benim[j][0] == '+') cnt++; benimscore += timetoscore(benim[j]); } sort(score,score+n-1,cmp); // for (int i = 0; i < n-1; ++i) // { // cout << score[i].fi << sp << score[i].se << endl;; // } // cout<< cnt << sp<< benimscore << endl; // cout << endl; for (int i = 0; i < n-1; ++i) { if(cnt < score[i].fi) continue; if(cnt <= score[i].fi and benimscore < score[i].se){ cout << i+1 << endl; return; } } cout << n << endl; // cout <<endl<< benimscore << endl; } int main() { // cout << fixed << setprecision(12); // freopen("feast.in","r",stdin); // freopen("feast.out","w",stdout); // fast;[Finished in 546ms] int t = 1; // cin >> t; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...