제출 #699200

#제출 시각아이디문제언어결과실행 시간메모리
699200Elrawy1Art Exhibition (JOI18_art)C++17
50 / 100
1086 ms35436 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str ;
typedef double db;
#define endl '\n';
const int N=1e5+4;
const double pi=3.14159265359;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

int n;
cin>>n;
map<ll,ll>x;
ll sum=0;
ll d[n];
for(int i=0;i<n;i++){
    ll m,k;
    cin>>m>>k;
    sum+=k;
    x[m]+=k;
    d[i]=m;

}
 ll j=sum;

sort(d,d+n);
ll Max=0,s,o;
for(int h=0;h<n;h++){
    sum=j;

for(int i=n-1;i>=h;i--){

        s = d[i] - d[h];
        Max = max(Max, (sum - s));
        sum -= x[d[i]];


    }
j-=x[d[h]];

}

cout<<Max;


}

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

art.cpp: In function 'int main()':
art.cpp:29:12: warning: unused variable 'o' [-Wunused-variable]
   29 | ll Max=0,s,o;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...