답안 #972416

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972416 2024-04-30T11:51:40 Z vjudge1 Art Exhibition (JOI18_art) C++17
컴파일 오류
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;
int cnt[N];
map<pair<int,int>,int>mp;
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:44:26: error: a function-definition is not allowed here before '{' token
   44 | ponchik (/*Alfar ABI*/ ) {
      |                          ^
art.cpp:49:1: error: expected '}' at end of input
   49 | }
      | ^
art.cpp:16:14: note: to match this '{'
   16 | void solve() {
      |              ^