Submission #972418

# Submission time Handle Problem Language Result Execution time Memory
972418 2024-04-30T11:52:16 Z vjudge1 Art Exhibition (JOI18_art) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define pon ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  int T=1;
#define ponchik signed main
#define pb push_back
#define pf push_front
#define endl "\n"
#define F first
#define S second

const int N=1e5+69,INF=1e18+1488;
void solve() {
	int n;
	vector <pair<int,int>> v;
	cin>>n;
	for (int i=0; i<n; i++)
	{
		int a,b;
		cin>>a>>b;
		v.pb({a,b});
	}
	sort(v.begin(),v.end());
	int sum=v[0].S,ans=0,pos1=0;
	for (int i=1; i<n; i++)
	{
		sum+=v[i].S;
		if (v[i].F-v[pos1].F<=sum) ans+=sum,sum=0,pos1=i;
	}
	int pos2=0;
	sum=0;
	for (int i=1; i<=pos1; i++)
	{
		sum+=v[i-1].S;
		if (v[i].F-v[pos2].F>=sum) ans-=sum,sum=0,pos2=i;
	}
	int mx=ans-v[pos1].F+v[pos2].F;
	for (int i=0; i<n; i++) mx=max(mx,v[i].S);
	cout<<mx;

ponchik (/*Alfar ABI*/ ) {
    pon
//  freopen( "###.in" ,"r",stdin); freopen( "###.out" ,"w",stdout);
//	cin>>T;
	while (T--){solve();}
}

Compilation message

art.cpp: In function 'void solve()':
art.cpp:42:26: error: a function-definition is not allowed here before '{' token
   42 | ponchik (/*Alfar ABI*/ ) {
      |                          ^
art.cpp:47:1: error: expected '}' at end of input
   47 | }
      | ^
art.cpp:14:14: note: to match this '{'
   14 | void solve() {
      |              ^