結果

問題 No.3042 拡大コピー
ユーザー GOTKAKO
提出日時 2025-02-28 22:19:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,370 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 203,536 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-03-01 07:38:56
合計ジャッジ時間 3,629 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    string X,Y;
    auto comp = [&](const string &a,const string &b) -> int {
        if(a == "") return 1;
        for(int i=0; i<a.size(); i++){
            if(a.at(i) > b.at(i)) return 0;
            else if(a.at(i) < b.at(i)) return 1;
        }
        return -1;
    };

    for(int i=0; i<N; i++){
        string s,t; cin >> s >> t;
        string x = "",y = "";
        string a = "";
        string b = "";
        bool under1 = false;
        for(auto c : s){
            if(c == '.'){under1 = true; continue;}
            if(under1) b += c;
            else a += c;
        }
        int left = 10-a.size();
        while(left--) x += '0';
        x += a+b;
        left = 16-b.size();
        while(left--) x += '0';

        a = "",b = ""; under1 = false;
        for(auto c : t){
            if(c == '.'){under1 = true; continue;}
            if(under1) b += c;
            else a += c;
        }
        left = 10-a.size();
        while(left--) y += '0';
        y += a+b;
        left = 16-b.size();
        while(left--) y += '0';
        
        int k = comp(X,x);
        if(k == 0) continue;
        if(k == 1) X = x,Y = y;
        else if(comp(Y,y) == 1) X = x,Y = y; 
    }
    
    string X2 = "",Y2 = "";
    for(int i=0; i<N; i++){
        string s,t; cin >> s >> t;
        string x = "",y = "";
        string a = "";
        string b = "";
        bool under1 = false;
        for(auto c : s){
            if(c == '.'){under1 = true; continue;}
            if(under1) b += c;
            else a += c;
        }
        int left = 10-a.size();
        while(left--) x += '0';
        x += a+b;
        left = 16-b.size();
        while(left--) x += '0';

        a = "",b = ""; under1 = false;
        for(auto c : t){
            if(c == '.'){under1 = true; continue;}
            if(under1) b += c;
            else a += c;
        }
        left = 10-a.size();
        while(left--) y += '0';
        y += a+b;
        left = 16-b.size();
        while(left--) y += '0';
        
        int k = comp(X2,x);
        if(k == 0) continue;
        if(k == 1) X2 = x,Y2 = y;
        else if(comp(Y2,y) == 1) X2 = x,Y2 = y; 
    }
    cout << fixed << setprecision(20) << stold(X2)/stold(X) << endl;
}
0