結果
問題 | No.723 2つの数の和 |
ユーザー | batasanblog |
提出日時 | 2023-07-15 15:58:47 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 117 ms / 2,000 ms |
コード長 | 2,086 bytes |
コンパイル時間 | 5,075 ms |
コンパイル使用メモリ | 263,456 KB |
実行使用メモリ | 13,304 KB |
最終ジャッジ日時 | 2023-10-17 02:22:33 |
合計ジャッジ時間 | 8,576 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
12,520 KB |
testcase_01 | AC | 87 ms
12,520 KB |
testcase_02 | AC | 88 ms
12,520 KB |
testcase_03 | AC | 106 ms
13,068 KB |
testcase_04 | AC | 112 ms
13,248 KB |
testcase_05 | AC | 112 ms
13,184 KB |
testcase_06 | AC | 111 ms
13,216 KB |
testcase_07 | AC | 98 ms
12,828 KB |
testcase_08 | AC | 100 ms
12,868 KB |
testcase_09 | AC | 113 ms
13,268 KB |
testcase_10 | AC | 97 ms
12,812 KB |
testcase_11 | AC | 88 ms
12,580 KB |
testcase_12 | AC | 101 ms
12,928 KB |
testcase_13 | AC | 114 ms
13,296 KB |
testcase_14 | AC | 93 ms
12,704 KB |
testcase_15 | AC | 98 ms
12,840 KB |
testcase_16 | AC | 104 ms
13,004 KB |
testcase_17 | AC | 111 ms
13,160 KB |
testcase_18 | AC | 103 ms
13,304 KB |
testcase_19 | AC | 117 ms
13,304 KB |
testcase_20 | AC | 87 ms
12,520 KB |
testcase_21 | AC | 87 ms
12,520 KB |
testcase_22 | AC | 86 ms
12,520 KB |
testcase_23 | AC | 114 ms
13,304 KB |
testcase_24 | AC | 94 ms
12,744 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; //using mint = static_modint<998244353>; //using mint = modint; using mint = static_modint<1000000007>; using vm = vector<mint>; using vvm = vector<vm>; ostream &operator<<(ostream &o,const mint &m){cout<<m.val();return o;} using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using pl = pair<ll,ll>; using vp = vector<pl>; #define rep(i,n) for(ll i=0;i<(ll)(n);++i) #define reps(i,s,n) for(ll i=(s);i<(ll)(n);++i) #define rep1(i,n) for(ll i=1;i<=(ll)(n);++i) template<typename T>inline bool chmax(T &a,T b){return a<b?a=b,true:false;} template<typename T>inline bool chmin(T &a,T b){return a>b?a=b,true:false;} #define fi first #define se second #define pb push_back #define eb emplace_back #define be(v) (v).begin(),(v).end() const long long INF = 1e18; #ifdef DEBUG #include <debug.hpp> random_device rd; mt19937 gen(rd()); ll random(ll l,ll h){ uniform_int_distribution<ll> dist(l,h); return dist(gen); } #endif const ll MX=100001; ll N,X; vl A; void input(){ cin>>N>>X; A.assign(N,0); rep(n,N)cin>>A.at(n); } #ifdef DEBUG void showall(){ show(N,X); } #endif ll logic(){ vl v(MX,0); rep(n,N){ v.at(A.at(n))++; } vl w = convolution_ll(v,v); #ifdef DEBUG rep(i,v.size()){ if(v.at(i)>0)show(i,v.at(i)); } show("---"); rep(i,w.size()){ if(w.at(i)>0)show(i,w.at(i)); } #endif ll ans; if(X < w.size()) ans = w.at(X); else ans = 0; return ans; } #ifdef DEBUG ll naive(){ return 1; } #endif int main(){ #ifdef DEBUG cout << "--- Input ---" << endl; #endif input(); #ifdef DEBUG showall(); cout << "--- Logic ---" << endl; #endif ll ans=logic(); #ifdef DEBUG cout << "--- Answer ---" << endl; #endif cout<<ans<<endl; //while(input())logic(); #ifdef DEBUG //show("naive=",naive()); #endif #ifdef DEBUG /* rep(q,100){ N=random(1LL,1000LL); showall(); ll lans=logic(),nans=naive(); if(lans!=nans){ show(" WA",lans,nans); break; } else{ show(" AC",lans,nans); } } */ #endif return 0; } //cout << fixed << setprecision(9);