Submission #936959

#TimeUsernameProblemLanguageResultExecution timeMemory
936959089487Med (COCI22_med)C++14
50 / 50
39 ms19256 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("sse4,abm,avx,popcnt") #include<bits/stdc++.h> #define int long long #define quick ios::sync_with_stdio(0);cin.tie(0); #define rep(x,a,b) for(int x=a;x<=b;x++) #define repd(x,a,b) for(int x=a;x>=b;x--) #define F first #define S second #define eb emplace_back #define mp make_pair #define mt make_tuple #define all(x) x.begin(),x.end() #define sz(x) (int)(x.size()) #define lowbit(x) (x&-x) using namespace std; typedef pair<int,int> pii; void debug(){ cout<<"\n"; } template<class T,class ...U> void debug(T a,U ...b){ cout<<a<<" ",debug(b...); } const int N=2e5+7; const int INF=1e18L; pair<pair<int,string>,int> v[N]; pair<pair<int,string>,int> v2[N]; bool cmp(pair<pair<int,string> ,int> &a,pair<pair<int,string>,int > &b){ if(a.F.F!=b.F.F){ return a.F.F>b.F.F; } return a.F.S<b.F.S; } signed main(){ quick int n; cin>>n; rep(i,1,n){ cin>>v[i].F.S; rep(t,1,5){ int k; cin>>k; v[i].F.F+=k; } v[i].S=i; } rep(i,1,n){ rep(j,1,n){ v2[j]=v[j]; if(j!=i) v2[j].F.F+=500; } sort(v2+1,v2+n+1,cmp); int worst=0; rep(j,1,n){ if(v2[j].S==i) { worst=j; break; } } rep(j,1,n){ v2[j]=v[j]; if(j==i) v2[j].F.F+=500; } sort(v2+1,v2+n+1,cmp); int best=0; rep(j,1,n){ if(v2[j].S==i) { best=j; break; } } cout<<best<<" "<<worst<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...