結果
| 問題 | No.3800 Screw manufacturing |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2026-11-13 23:46:14 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 52 ms / 2,000 ms |
| + 283µs | |
| コード長 | 1,470 bytes |
| 記録 | |
| コンパイル時間 | 3,881 ms |
| コンパイル使用メモリ | 364,436 KB |
| 実行使用メモリ | 6,784 KB |
| 最終ジャッジ日時 | 2026-11-13 23:46:25 |
| 合計ジャッジ時間 | 8,467 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 53 |
ソースコード
#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
} int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, t;
cin >> n >> t;
struct S { int a, b, r; };
vector<S> abr(n);
for (auto& [a, b, r] : abr) cin >> r;
for (auto& [a, b, r] : abr) cin >> a >> b;
ranges::sort(abr, {}, [](S x) {
auto [a, b, r] = x;
if (a <= b) return P{0, a};
else return P{1, -b};
});
ll add = 0;
ll sa = 0, sb = 0;
rep(i, n) {
auto [a, b, r] = abr[i];
// sa+a <= add+sb
// sa+ra <= add+sb+(r-1)b
chmax(add, sa + a - sb);
chmax(add, sa + (ll)r * a - sb - ll(r - 1) * b);
sa += (ll)r * a, sb += (ll)r * b;
if (i + 1 < n) sa += t, sb += t;
}
ll ans = add + sb;
cout << ans / (24 * 60) << ' ' << ans / 60 % 24 << ' ' << ans % 60 << '\n';
}
Kude