結果
| 問題 | No.728 ギブ and テイク |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-27 03:19:30 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 571 bytes |
| 記録 | |
| コンパイル時間 | 704 ms |
| コンパイル使用メモリ | 79,220 KB |
| 実行使用メモリ | 8,032 KB |
| 最終ジャッジ日時 | 2026-01-27 03:19:38 |
| 合計ジャッジ時間 | 7,872 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 1 -- * 14 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
typedef long long LL;
const int N = 300010;
int n;
LL a[N], l[N], r[N];
LL ans;
void Solve() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
for (int i = 1; i <= n; ++i) scanf("%lld%lld", &l[i], &r[i]);
ans = 0LL;
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
if (a[j] <= a[i] + r[i] && a[i] >= a[j] - l[j]) ++ans;
}
}
printf("%lld\n", ans);
}
int main() {
Solve();
return 0;
}