結果
| 問題 |
No.165 四角で囲え!
|
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2015-03-12 23:38:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,391 bytes |
| コンパイル時間 | 1,151 ms |
| コンパイル使用メモリ | 95,804 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-24 20:39:21 |
| 合計ジャッジ時間 | 9,672 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 3 WA * 16 |
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <complex>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
int N, B; cin >> N >> B;
vector<pair<i_i, int> > a(N);
for (int i = 0; i < N; i++) {
int X, Y, P; cin >> X >> Y >> P;
a[i] = make_pair(i_i(X, Y), P);
}
sort(a.begin(), a.end());
int maxi = 0;
for (int l = 0; l <= N; l++)
for (int r = l; r <= N; r++) {
vector<i_i> b;
for (int i = 0; i < N; i++) {
int x = a[i].first.first;
int y = a[i].first.second;
int p = a[i].second;
if (x >= a[l].first.first && x < a[r].first.first)
b.push_back(i_i(y, p));
}
sort(b.begin(), b.end());
int n = b.size();
int d = 0, sum = 0;
for (int u = 0; u <= n; u++) {
while (d < n && sum + b[d].second <= B) d++;
maxi = max(maxi, d - u);
}
}
cout << maxi << endl;
}
sugim48