結果
問題 |
No.949 飲酒プログラミングコンテスト
|
ユーザー |
![]() |
提出日時 | 2019-12-12 02:14:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,000 bytes |
コンパイル時間 | 1,844 ms |
コンパイル使用メモリ | 172,832 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 08:16:02 |
合計ジャッジ時間 | 2,907 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 WA * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long LL; typedef pair<int,int> P; const LL mod=1000000007; const LL LINF=1LL<<60; const int INF=1<<30; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; int main(){ int n;cin >> n; vector<int> a(n+1),b(n+1),d(n); for (int i = 0; i < n+1; i++) { cin >> a[i]; } for (int i = 0; i < n+1; i++) { cin >> b[i]; } for (int i = 0; i < n; i++) { cin >> d[i]; } sort(RALL(d)); int ia=0,ib=0,id=0; int ans = 0; while(true){ if(a[ia] - a[ia+1] > b[ib] - b[ib+1]) ib++; else ia++; while(id < n && a[ia] + b[ib] < d[id]) id++; if(id >= n){ cout << ans << endl; return 0; } else{ ans++; id++; } } return 0; }