結果

問題 No.3800 Screw manufacturing
コンテスト
ユーザー GOTKAKO
提出日時 2026-11-14 00:07:41
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 918 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,783 ms
コンパイル使用メモリ 226,932 KB
実行使用メモリ 18,012 KB
最終ジャッジ日時 2026-11-14 00:07:49
合計ジャッジ時間 7,241 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    long long N,T; cin >> N >> T;
    vector<long long> R(N);
    vector<tuple<long long,long long,long long>> big,small;
    for(auto &r : R) cin >> r;
    for(int i=0; i<N; i++){
        int a,b; cin >> a >> b;
        if(a <= b) big.push_back({a,b,R.at(i)});
        else small.push_back({a,b,R.at(i)});
    }
    sort(big.begin(),big.end());
    long long t1 = 0,t2 = 0;
    for(auto [a,b,r] : big){
        if(t1) t1 += T;
        if(t2) t2 += T;
        t2 = max(t2,t1+a)+b*r,t1 += a*r;
        t2 = max(t2,t1+b);
    }
    for(auto [a,b,r] : small){
        if(t1) t1 += T;
        if(t2) t2 += T;
        t2 = max(t2,t1+a)+b*r,t1 += a*r;
        t2 = max(t2,t1+b);
    }

    long long answer = t2;
    cout << answer/(24*60) << " " << answer%(24*60)/60 << " " << answer%60 << endl; 
}
0