답안 #229446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
229446 2020-05-04T13:59:45 Z bharat2002 Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 4840 KB
#include<bits/stdc++.h>
using namespace std;
const int N=1e5 + 100;
const int mod=1e9 + 7;
#define int long long
const int inf=1e18;
#define pii pair<int, int>
#define f first
#define s second 
#define mp make_pair
#define FOR(i, n) for(int i=1;i<=n;i++)
#define TRACE(x) cerr << #x << " = " << x << endl 
//Trace prints the name of the variable and the value.
long double a[N], b[N];int n;
bool sf(long double f, long double s)
{
	return f>s;
}
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
	sort(a+1, a+n+1, sf);sort(b+1, b+n+1, sf);
	for(int i=2;i<=n;i++) {a[i]+=a[i-1];b[i]+=b[i-1];}
	int i=1, j=1;a[n+1]=b[n+1]=1000000000;
	long double ans=0.0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			ans=max(ans, min(a[i], b[j]) - i - j);
		}
	}
	cout<<fixed<<setprecision(4)<<ans;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:26:6: warning: unused variable 'i' [-Wunused-variable]
  int i=1, j=1;a[n+1]=b[n+1]=1000000000;
      ^
sure.cpp:26:11: warning: unused variable 'j' [-Wunused-variable]
  int i=1, j=1;a[n+1]=b[n+1]=1000000000;
           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 10 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 13 ms 384 KB Output is correct
15 Correct 11 ms 416 KB Output is correct
16 Correct 11 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 10 ms 384 KB Output is correct
13 Correct 12 ms 384 KB Output is correct
14 Correct 13 ms 384 KB Output is correct
15 Correct 11 ms 416 KB Output is correct
16 Correct 11 ms 384 KB Output is correct
17 Execution timed out 2064 ms 4840 KB Time limit exceeded
18 Halted 0 ms 0 KB -