제출 #1033921

#제출 시각아이디문제언어결과실행 시간메모리
1033921vjudge1Art Exhibition (JOI18_art)C++17
100 / 100
379 ms12116 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define el '\n' #define pb push_back #define mp make_pair #define niggers \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define file(name) \ freopen(name ".inp", "r", stdin); \ freopen(name ".out", "w", stdout); typedef long long ll; typedef pair<long long, long long> pll; typedef pair<int, int> pii; typedef vector<long long> vll; typedef vector<int> vi; const ll MOD = 1e9 + 7; const int inf = 1e9; const int mxN = 1e2 + 5; const int mxM = 1e3 + 5; const int N = 5e5 + 5; int hx[] = {-1, 0, 1, 0}; int hy[] = {0, 1, 0, -1}; ll pfs[N]; int main() { // freopen("b.inp", "r", stdin); // freopen("b.out", "w", stdout); ll pinkkiu = 1; // cin >> pinkkiu; while (pinkkiu--) { ll n; cin >> n; pll a[n + 5]; for (int i = 1; i <= n; ++i) { cin >> a[i].fi >> a[i].se; } ll ps[n + 5]; sort(a + 1, a + n + 1); for (int i = 1; i <= n; ++i) { pfs[i] = pfs[i - 1] + a[i].se; } ll mn = inf; ll ans = 0; for (int i = 1; i <= n; i++) { mn = min(mn, pfs[i - 1] - a[i].fi); ans = max(ans, pfs[i] - a[i].fi - mn); } cout << ans; } }

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

art.cpp: In function 'int main()':
art.cpp:49:12: warning: unused variable 'ps' [-Wunused-variable]
   49 |         ll ps[n + 5];
      |            ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...