제출 #571711

#제출 시각아이디문제언어결과실행 시간메모리
571711Quan2003Art Exhibition (JOI18_art)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include <iostream> #include<queue> #include<vector> #include<utility> using namespace std; typedef long long ll; const int sz=101; const int sz1=2e5+1; int n,x,k,i,j,w,m; ll res=1e18; ll ans=0; int movex[4]={0,0,1,-1}; int movey[4]={-1,1,0,0}; ll c[sz1]; vector<ll>adj[sz]; ll d[sz1]; vector<array<ll,2>>pic; ll dp[sz][sz]; int main(){ cin>>n; for(int i=0;i<n;i++){ ll u,v ;cin>>u>>v; pic.push_back({u,v}); } sort(pic.begin(),pic.end()); for(int i=1;i<=n;i++){ d[i]=pic[i-1][1]+d[i-1]; } ll curmax=0;ll curmin=pic[0][0]; ans=pic[0][1]; for(int i=1;i<=n;i++){ ans=max(ans,d[i]+curmin-pic[i-1][0]); } cout<<ans; }

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

art.cpp: In function 'int main()':
art.cpp:29:8: warning: unused variable 'curmax' [-Wunused-variable]
   29 |     ll curmax=0;ll curmin=pic[0][0]; ans=pic[0][1];
      |        ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...