Submission #619918

# Submission time Handle Problem Language Result Execution time Memory
619918 2022-08-02T17:14:37 Z errorgorn Med (COCI22_med) C++17
50 / 50
10 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound

#define rep(x,s,e) for (auto x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

int n;
string s[505];
int arr[505][5];
int brr[505];

signed main(){
	cin.tie(0);
	cout.tie(0);
	cin.sync_with_stdio(false);
	
	cin>>n;
	rep(x,0,n){
		cin>>s[x];
		rep(y,0,5) cin>>arr[x][y];
		rep(y,0,5) brr[x]+=arr[x][y];
	}
	
	vector<int> idx;
	rep(x,0,n) idx.pub(x);
	
	//rep(x,0,n) cout<<brr[x]<<" "; cout<<endl;
	
	rep(x,0,n){
		brr[x]+=500;
		
		sort(all(idx),[](int i,int j){
			if (brr[i]!=brr[j]) return brr[i]>brr[j];
			else return s[i]<s[j];
		});
		
		rep(y,0,n) if (idx[y]==x) cout<<y+1<<" ";
		
		brr[x]-=1000;
		
		sort(all(idx),[](int i,int j){
			if (brr[i]!=brr[j]) return brr[i]>brr[j];
			else return s[i]<s[j];
		});
		
		rep(y,0,n) if (idx[y]==x) cout<<y+1<<endl;
		
		brr[x]+=500;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 10 ms 340 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 10 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct