제출 #335931

#제출 시각아이디문제언어결과실행 시간메모리
335931Killer2501Art Exhibition (JOI18_art)C++14
0 / 100
7 ms7532 KiB
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pll pair<ll, ll>
#define pb push_back
#define pii pair<ll ,pll>
#define task "C"

using namespace std;
const int N = 3e5+5;
const int M = 4e6+5;
const int mod = 1e9+7;
ll n, t, m, k, a[N], b[N], ans, tong, h[N], u, v, st[N];
string s;
bool ok;

pll p[N];
struct dang
{
    ll x, y, id;
    dang(){}
    dang(ll x, ll y, ll id): x(x), y(y), id(id){}
};
vector<dang> adj[N];
bool cmp(const dang& u, const dang& v)
{
    return ((u.x < v.x) || (u.x == v.x && u.y < v.y));
}

void ss(ll x, ll y, dang z)
{
    if(x == z.x && y == z.y)
    {
        ok = true;
        ans = z.id;
    }
}
void sol()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        cin >> p[i].fi >> p[i].se;
    }
    sort(p+1, p+1+n);
    ans = p[1].se;
    a[1] = p[1].se;
    k = -p[1].fi;
    for(int i = 2; i <= n; i ++)
    {
        a[i] = a[i-1] + p[i].se;
        ans = max(ans, a[i] - p[i].fi - k);
        k = min(k, a[i-1] - p[i].se);
    }
    cout << ans;

}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(fopen(task".inp", "r"))
    {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    int ntest = 1;
    //cin >> ntest;
    while(ntest -- > 0)
    sol();
}

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

art.cpp: In function 'int main()':
art.cpp:66:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   66 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:67:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   67 |         freopen(task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...