Created
February 14, 2013 11:46
-
-
Save rohith2506/4952300 to your computer and use it in GitHub Desktop.
codeforces 167 div 2 problem 3:-
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <vector> | |
#include <cmath> | |
typedef long long int ll; | |
using namespace std; | |
int main(){ | |
int n; | |
cin>>n; | |
ll a[n]; | |
ll height[n]; | |
for(int i=0;i<n;i++){ | |
cin>>a[i]; | |
height[i]=a[i]; | |
} | |
//at normal heights | |
int m; | |
cin>>m; | |
ll res=0; | |
for(int i=0;i<m;i++){ | |
ll w,h; | |
cin>>w>>h; | |
res=std::max(res,a[w-1]); | |
cout<<res<<endl; | |
res+=h; | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment