제출 #128924

#제출 시각아이디문제언어결과실행 시간메모리
128924PlurmCake 3 (JOI19_cake3)C++17
0 / 100
8 ms424 KiB
#include <bits/stdc++.h> using namespace std; long long sv[2048][2048]; int main(){ int n,m; scanf("%d%d",&n,&m); int v,c; vector<pair<long long,long long> > pieces; for(int i = 0; i < n; i++){ scanf("%lld%lld",&v,&c); pieces.emplace_back(v,c); } sort(pieces.begin(), pieces.end(), [](pair<long long, long long> x, pair<long long, long long> y){ return x.second < y.second; }); long long ans = 0ll; for(int i = 0; i < n; i++){ for(int j = i+m-1; j < n; j++){ long long highsum = 0ll; vector<long long> use; for(int k = i+1; k < j; k++){ use.push_back(pieces[k].first); } sort(use.begin(), use.end()); use.push_back(pieces[i].first); use.push_back(pieces[j].first); for(int k = 0; k < m; k++){ highsum += use.back(); use.pop_back(); } highsum -= 2ll * abs(pieces[i].second - pieces[j].second); ans = max(ans, highsum); } } printf("%lld\n",ans); return 0; }

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

cake3.cpp: In function 'int main()':
cake3.cpp:10:31: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
         scanf("%lld%lld",&v,&c);
                          ~~   ^
cake3.cpp:10:31: warning: format '%lld' expects argument of type 'long long int*', but argument 3 has type 'int*' [-Wformat=]
cake3.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
cake3.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&v,&c);
         ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...