結果
| 問題 | No.165 四角で囲え! |
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2015-04-12 18:52:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 755 bytes |
| 記録 | |
| コンパイル時間 | 1,362 ms |
| コンパイル使用メモリ | 163,532 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 14:02:10 |
| 合計ジャッジ時間 | 3,338 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define chmax(a,x) a = max(a, x)
typedef long long ll;
ll N, B;
typedef pair<double, double> pdd;
typedef pair<pdd, double> pd3;
pd3 p[444];
int main() {
cin >> N >> B;
rep(i, N) {
double x, y, sc; cin >> x >> y >> sc;
p[i] = {{x, y}, sc};
}
sort(p, p+N);
ll ans = 0;
rep(i, N) REP(j, i+1, N) {
int L = i, R = i;
ll sum = 0;
while(L <= j && R <= j) {
if(sum + p[R].second <= B) {
sum += p[R++].second;
chmax(ans, (ll)(R-L));
}
else {
sum -= p[L++].second;
if(sum < 0) { R = L; sum = 0; }
}
}
}
cout << ans << endl;
return 0;
}
moti