結果
問題 |
No.949 飲酒プログラミングコンテスト
|
ユーザー |
![]() |
提出日時 | 2019-12-13 23:33:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 1,382 ms |
コンパイル使用メモリ | 165,124 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 21:35:45 |
合計ジャッジ時間 | 2,484 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 WA * 19 |
コンパイルメッセージ
main.cpp:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~
ソースコード
#pragma once #include <bits/stdc++.h> #define M_PI 3.14159265358979323846 // pi using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> VI; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> t3; #define rep(a,n) for(int a = 0;a < n;a++) #define repi(a,b,n) for(int a = b;a < n;a++) const ull mod = 1000000007; int main(void) { ll n; cin >> n; vector<ll> as(n+1); vector<ll> bs(n+1); vector<ll> ds(n); rep(i, n + 1) cin >> as[i]; rep(i, n + 1) cin >> bs[i]; rep(i, n) cin >> ds[i]; vector<ll> p(n); int a = 0; int b = 0; rep(i, n) { if (as[a + 1] + bs[b] < as[a] + bs[b + 1]) { b++; } else { a++; } p[i] = as[a] + bs[b]; } sort(ds.begin(), ds.end(), std::greater<ll>()); int sum = 0; rep(i, n) { auto l = lower_bound(ds.begin(), ds.end(), p[i], std::greater<ll>()); if (l != ds.end()) { sum++; ds.erase(l); } } cout << sum << endl; return 0; }