제출 #386857

#제출 시각아이디문제언어결과실행 시간메모리
386857ismoilovArt Exhibition (JOI18_art)C++14
100 / 100
203 ms21100 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fv(c) for(int (a) = (1); (a) <= (c); (a)++)
#define fz(c) for(int (a) = (0); (a) < (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
#define pb push_back
#define in insert
#define ss second
#define ff first
void S()
{
	ll n;
	cin >> n;
	vector <pair<ll, ll>> v(n);
	fp(i,0,n)
		cin >> v[i].ff >> v[i].ss;
	sort(all(v));
	ll mx, x, y;
	mx = x = y = 0;
	fp(i,0,n)
	{
		x = min(x, y - v[i].ff);
		y += v[i].ss;
		mx = max(mx, y - x - v[i].ff);
	}
	cout << mx;
		
}
int main()
{
	IOS;
	S();
	/*int t;
	cin >> t;
	while(t--)
		 S();*/
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'void S()':
art.cpp:9:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
art.cpp:24:2: note: in expansion of macro 'fp'
   24 |  fp(i,0,n)
      |  ^~
art.cpp:9:27: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    9 | #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
      |                           ^
art.cpp:29:2: note: in expansion of macro 'fp'
   29 |  fp(i,0,n)
      |  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...