Submission #103715

# Submission time Handle Problem Language Result Execution time Memory
103715 2019-04-02T07:47:52 Z E869120 Sure Bet (CEOI17_sure) C++14
100 / 100
152 ms 9488 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

long double A[100009], B[100009], maxn, v1, v2; int N;
vector<long double>X;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) { scanf("%Lf%Lf", &A[i], &B[i]); }
	sort(A, A + N); reverse(A, A + N);
	sort(B, B + N); reverse(B, B + N);
	long double s1 = 0; for (int i = 0; i <= N; i++) { X.push_back(s1); s1 += A[i]; } v1 = s1;
	long double s2 = 0; for (int i = 0; i <= N; i++) { X.push_back(s2); s2 += B[i]; } v2 = s2;
	sort(X.begin(), X.end());
	for (int i = 0; i < X.size(); i++) { if (X[i] > min(v1, v2) + 1e-9) break; maxn = max(maxn, X[i] - 1.0L*i); }
	printf("%.4Lf\n", maxn);
	return 0;
}

Compilation message

sure.cpp:5:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
sure.cpp: In function 'int main()':
sure.cpp:18:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < X.size(); i++) { if (X[i] > min(v1, v2) + 1e-9) break; maxn = max(maxn, X[i] - 1.0L*i); }
                  ~~^~~~~~~~~~
sure.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
sure.cpp:12:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 0; i < N; i++) { scanf("%Lf%Lf", &A[i], &B[i]); }
                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
17 Correct 114 ms 9068 KB Output is correct
18 Correct 124 ms 9064 KB Output is correct
19 Correct 143 ms 9140 KB Output is correct
20 Correct 129 ms 9128 KB Output is correct
21 Correct 127 ms 9488 KB Output is correct
22 Correct 127 ms 9064 KB Output is correct
23 Correct 124 ms 9180 KB Output is correct
24 Correct 119 ms 9084 KB Output is correct
25 Correct 120 ms 9080 KB Output is correct
26 Correct 152 ms 9448 KB Output is correct