답안 #670538

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670538 2022-12-09T13:55:26 Z mseebacher Art Exhibition (JOI18_art) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
             
 
#define MAXI (int)1e5
#define LSOne(S) ((S) & -(S))
#define MSB(S) __builtin_clz(S)
 
vector<ll> ft;
 
 
 
void solve(){
	
	int n; cin >> n;
	vector<pair<ll,ll>> bilder;
	for(int i = 0;i<n;i++){
		ll a,b; cin >> a >> b;
		bilder.push_back({a,b});
	}
	ll maxi = 0;
	sort(bilder.begin(),bilder.end());
	for(int i = 0;i<n;i++){
		ll summe = bilder[i].second;
		for(int j = i+1;j<n;j++){
			summe += bilder[j].second;
			maxi = max(summe+bilder[i].first-bilder[j].first,maxi);
		}
	}
	cout << maxi;
}
 
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cout << fixed << setprecision(8);
 
   int t = 1;
   //cin >> t;
   while(t){
	solve();
	t--;  
	cout << "\n";
   }
  return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -