᠌᠌᠌᠌
Andrea Cazzato   Lecce, Puglia, Italy
 
 
#include <iostream>
#include <math.h>

using namespace std;

typedef struct{
int32_t i;
int32_t att;
int32_t inc;
}cor;

int main(){
int32_t N,i,j,k;
cor A[65537];
cor tmp;

freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

cin >> N;

for(i=0;i<N;i++){
cin >> A .att >> A .inc;
A .att += A .inc;
A .i = i;
}


for(i=0,k=pow(2,i)-1; k!=N-1; i++){
for(k=pow(2,i)-1; k<(N-k)/2+k; k++){
for(j=k+1; j<N-1; j++){
if(A[k].att>A[j].att){
tmp=A[k];
A[k]=A[j];
A[j]=tmp;
}
else if(A[k].att==A[j].att){
if(A[k].i>A[j].i){
tmp=A[k];
A[k]=A[j];
A[j]=tmp;
}
}
}
}
for(j=pow(2,i)-1; j<N; j++){
A .att += A .inc;
}
}




cout << A[N-1].i;

return 0;
}
Currently Offline
Recent Activity
631 hrs on record
last played on 7 Apr, 2024
0.9 hrs on record
last played on 19 Jan, 2022
4 hrs on record
last played on 29 Mar, 2020
Comments
Kalhala 1 May, 2024 @ 7:47am 
Your gaming throne awaits!
76561199530277761 19 Apr, 2024 @ 3:06pm 
add me
diunu 10 Apr, 2024 @ 2:56am 
+rep pretty good player