結果
| 問題 | No.3711 Udon, Tempura |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-11 22:02:07 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 28 ms / 2,000 ms |
| + 574µs | |
| コード長 | 561 bytes |
| 記録 | |
| コンパイル時間 | 2,243 ms |
| コンパイル使用メモリ | 354,400 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-09-11 22:02:30 |
| 合計ジャッジ時間 | 4,801 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pint=pair<int,int>;
#define rep(i,n) for(int i=0;i<(n);++i)
template<typename T>
void chmax(T& a,T b){if(a<b){a=b;};}
template<typename T>
void chmin(T& a,T b){if(a>b){a=b;};}
const int inf=1e9;
int main(){
int n,m;cin>>n>>m;
vector<int> u(n),d(m);
rep(i,n)cin>>u[i];
rep(i,m)cin>>d[i];
vector<bool> dp(200000+1);
rep(i,n)dp[u[i]]=true;
rep(i,m)for(int j=200000-d[i];j>=0;--j)if(dp[j]){
dp[j+d[i]]=true;
}
int ans=0;
rep(i,200000+1)ans+=dp[i];
cout<<ans<<endl;
}