답안 #234280

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234280 2020-05-23T18:11:51 Z nafis_shifat Sure Bet (CEOI17_sure) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin>>n;
    
    vector<double> v1,v2;
    
    for(int i=0;i<n;i++) {
        double a,b;
        cin>>a>>b;
        a-=1;
        b-=1;
        v1.push_back(a);
        v2.push_back(b);
    }
    
    sort(v1.begin(),v1.end(),greater<double>());
    sort(v2.begin(),v2.end(),greater<double>());
    
    double s1[n],s2[n];
    s1[0]=v1[0];
    s2[0]=v2[0];
    for(int i=1;i<n;i++) {
        s1[i]=s1[i-1]+v1[i];
        s2[i]=s2[i-1]+v2[i];
    }
    
    
    
    
    
    double res=0;
    int ptr=0;
    for(int i=0;i<n;i++) {
        while(ptr+1<n && s1[i]>s2[ptr]) {
            res=max(res,min(s1[i]-ptr-1,s2[ptr]-i-1));
            ptr++;
        }
        res=max(res,min(s1[i]-ptr-1,s2[ptr]-i-1));
    }
    
    cout<<fixed<<setprecision(4);
    cout<<res<<endl;
    
    
    
    
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Incorrect 5 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Incorrect 5 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Incorrect 5 ms 384 KB Output isn't correct