Submission #47022

#TimeUsernameProblemLanguageResultExecution timeMemory
47022leejseoArt Exhibition (JOI18_art)C++17
0 / 100
2 ms376 KiB
#include <stdio.h> #include <utility> #include <algorithm> #include <vector> using namespace std; typedef long long lld; typedef pair<lld, lld> pll; lld ans; int N; int main(void){ scanf("%d", &N); lld X, Y, S[N+1]; pll U[N]; S[0] = 0; for (int i=0; i<N; i++){ scanf("%d%d", &X, &Y); U[i] = make_pair(X, Y); } sort(U, U+N); for (int i=0; i<N; i++){ S[i+1] = S[i] + U[i].second; } Y = -(U[0].first); for (int i=1; i<=N; i++){ X = S[i] - U[i-1].first; ans = max(ans, X - Y); if (i == N) break; Y = min(Y, S[i]-U[i].first); } printf("%lld", ans); }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:16:23: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'lld* {aka long long int*}' [-Wformat=]
   scanf("%d%d", &X, &Y);
                 ~~    ^
art.cpp:16:23: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'lld* {aka long long int*}' [-Wformat=]
art.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
art.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &X, &Y);
   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...