結果
問題 | No.33 アメーバがたくさん |
ユーザー | shihu |
提出日時 | 2024-09-28 16:57:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,354 bytes |
コンパイル時間 | 5,864 ms |
コンパイル使用メモリ | 306,984 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-28 16:57:58 |
合計ジャッジ時間 | 6,001 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 2 ms
6,820 KB |
testcase_05 | AC | 1 ms
6,816 KB |
testcase_06 | WA | - |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 2 ms
6,820 KB |
ソースコード
// #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using mint = modint998244353; // using mint = modint1000000007; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using T = tuple<int, int, int>; using G = vector<vector<int>>; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep2(i, a, b) for (ll i = a; i < (b); ++i) #define rrep2(i, a, b) for (ll i = a-1; i >= (b); --i) #define rep3(i, a, b, c) for (ll i = a; i < (b); i+=c) #define rng(a) a.begin(),a.end() #define rrng(a) a.rbegin(),a.rend() #define popcount __builtin_popcount #define popcountll __builtin_popcountll #define fi first #define se second #define UNIQUE(v) sort(rng(v)), v.erase(unique(rng(v)), v.end()) #define MIN(v) *min_element(rng(v)) #define MAX(v) *max_element(rng(v)) #define SUM(v) accumulate(rng(v),0) #define IN(v, x) (find(rng(v),x) != v.end()) template<class T> bool chmin(T &a,T b){if(a>b){a=b;return 1;}else return 0;} template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;} template<class T> void printv(vector<T> &v){rep(i,v.size())cout<<v[i]<<" \n"[i==v.size()-1];} template<class T> void printvv(vector<vector<T>> &v){rep(i,v.size())rep(j,v[i].size())cout<<v[i][j]<<" \n"[j==v[i].size()-1];cout<<endl;} const ll dx[] = {0, 1, 0, -1}; const ll dy[] = {1, 0, -1, 0}; const ll dxx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const ll dyy[] = {1, 0, -1, 0, 1, 1, -1, -1}; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; ll d, t; cin >> n >> d >> t; vector<ll> x(n); rep(i, n) cin >> x[i]; map<ll, vector<ll>> mp; rep(i, n){ mp[(x[i]%d+d)%d].push_back(x[i]); } for (auto [k, v]: mp) sort(rng(v)); ll ans = 0; for (auto [k, v]: mp){ ll l = v[0]-t*d, r = v[0]+t*d; rep2(i, 1, v.size()){ ll nl = v[i]-t*d, nr = v[i]+t*d; if (r < nl){ ans += (r-l)/d+1; l = nl; r = nr; continue; } r = nr; } ans += (r-l)/d+1; } cout << ans << endl; return 0; }