Submission #47022

# Submission time Handle Problem Language Result Execution time Memory
47022 2018-04-26T12:51:07 Z leejseo Art Exhibition (JOI18_art) C++17
0 / 100
2 ms 376 KB
#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

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 time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -