結果
問題 | No.2054 Different Sequence |
ユーザー | fact493 |
提出日時 | 2022-08-21 12:55:11 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 7,649 bytes |
コンパイル時間 | 4,445 ms |
コンパイル使用メモリ | 248,264 KB |
実行使用メモリ | 15,472 KB |
最終ジャッジ日時 | 2024-10-10 05:55:16 |
合計ジャッジ時間 | 5,264 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
15,424 KB |
testcase_01 | AC | 16 ms
15,180 KB |
testcase_02 | AC | 16 ms
15,308 KB |
testcase_03 | AC | 15 ms
15,352 KB |
testcase_04 | AC | 15 ms
15,332 KB |
testcase_05 | AC | 14 ms
15,472 KB |
testcase_06 | AC | 14 ms
15,320 KB |
testcase_07 | AC | 15 ms
15,380 KB |
testcase_08 | AC | 15 ms
15,272 KB |
testcase_09 | AC | 15 ms
15,352 KB |
testcase_10 | AC | 17 ms
15,232 KB |
testcase_11 | AC | 16 ms
15,360 KB |
testcase_12 | AC | 16 ms
15,272 KB |
testcase_13 | AC | 15 ms
15,232 KB |
testcase_14 | AC | 15 ms
15,232 KB |
testcase_15 | AC | 16 ms
15,264 KB |
testcase_16 | AC | 15 ms
15,360 KB |
testcase_17 | AC | 16 ms
15,360 KB |
testcase_18 | AC | 15 ms
15,296 KB |
testcase_19 | AC | 16 ms
15,276 KB |
testcase_20 | AC | 15 ms
15,360 KB |
testcase_21 | AC | 16 ms
15,360 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>; typedef pair<ll, ll> P; typedef tuple<ll, ll, ll> PP; typedef tuple<ll, ll, ll, ll> PPP; using vvvvl = vector<vvvl>; using vp = vector<P>; using vvp = vector<vp>; using vb = vector<bool>; using vvb = vector<vb>; #define lb(v, k) (lower_bound(all(v), (k)) - v.begin()) #define ub(v, k) (upper_bound(all(v), (k)) - v.begin()) #define eb emplace_back #define fi first #define se second #define pq(T) priority_queue<T> #define pqr(T) priority_queue<T, vector<T>, greater<T>> #define pcount(i) __builtin_popcount(i); #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define all(a) (a).begin(), (a).end() #define double long double #define yesno(i) if(i)cout<<"yes"<<endl;else cout<<"no"<<endl; #define YesNo(i) if(i)cout<<"Yes"<<endl;else cout<<"No"<<endl; #define YESNO(i) if(i)cout<<"YES"<<endl;else cout<<"NO"<<endl; #define cinvec(x) \ for (ll hfuaig = 0; hfuaig < x.size(); hfuaig++) \ { \ cin >> x.at(hfuaig); \ } #define coutvece(x) \ for (ll hfuaig = 0; hfuaig < x.size(); hfuaig++) \ { \ cout << x.at(hfuaig) << endl; \ } #define coutvec(x) \ for (ll hfuaig = 0; hfuaig < x.size(); hfuaig++) \ { \ cout << x.at(hfuaig) << ' '; \ } template <typename T> bool chmax(T &a, const T& b){ if(a < b){ a = b; return true; } return false; } template <typename T> bool chmin(T &a, const T& b){ if(a > b){ a = b; return true; } return false; } const ll mod = 998244353; const ll Mod = 1000000007; const ll inf = 999999999999999999LL; #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") ll gcd(ll A, ll B){ if(A % B == 0){ return B; } else{ return gcd(B, A % B); } } ll lcm(ll A, ll B){ return A * B / gcd(A, B); } long long modpow(long long a, long long n, long long mo) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mo; a = a * a % mo; n >>= 1; } return res; } //円の位置関係 bool isd(double a, double b, double c){ if(c > (a + b) * (a + b)){ return false; } if(c == (a + b) * (a + b)){ return true; } if(abs(a - b) * abs(a - b) < c && c < (a + b) * (a + b)){ return true; } if(c == abs(a - b) * abs(a - b)){ return true; } if(c < abs(a - b) * abs(a - b)){ return false; } return true; } const int MAX = 500000; const int MOD = mod; ll fact[MAX], inv_fact[MAX], inv[MAX]; void init() { // 初期値設定と1はじまりインデックスに直す fact[0] = 1; fact[1] = 1; inv[0] = 1; inv[1] = 1; inv_fact[0] = 1; inv_fact[1] = 1; // メモの計算 repi(i, 2, MAX){ // 階乗 fact[i] = fact[i - 1] * i % MOD; // 逆元 inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; // 逆元の階乗 inv_fact[i] = inv_fact[i - 1] * inv[i] % MOD; } } ll nck(int n, int k) { ll x = fact[n]; // n!の計算 ll y = inv_fact[n-k]; // (n-k)!の計算 ll z = inv_fact[k]; // k!の計算 if (n < k) return 0; // 例外処理 if (n < 0 || k < 0) return 0; // 例外処理 return x * ((y * z) % MOD) % MOD; //二項係数の計算 } struct Edge { long long to; long long cost; }; struct graph{ vvp G; vl dis; vl prev; vl dijkstra(ll i){ ll N = G.size(); dis.assign(N, inf); prev.assign(N, -1); priority_queue<P, vector<P>, greater<P>> pq; // 「仮の最短距離, 頂点」が小さい順に並ぶ dis[i] = 0; pq.emplace(dis[i], i); while (!pq.empty()) { P p = pq.top(); pq.pop(); ll v = p.second; if (dis[v] < p.first) { // 最短距離で無ければ無視 continue; } for (auto &e : G[v]) { if (dis[e.fi] > dis[v] + e.se) { // 最短距離候補なら priority_queue に追加 dis[e.fi] = dis[v] + e.se; prev[e.fi] = v; pq.emplace(dis[e.fi], e.fi); } } } return dis; } vl get_path(ll t){ vl path; for (ll cur = t; cur != -1; cur = prev[cur]) { path.push_back(cur); } reverse(path.begin(), path.end()); // 逆順なのでひっくり返す return path; } }; void beg(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(20); init(); srand((unsigned int)time(NULL)); } struct BIT { private: vector<int> bit; ll N; public: BIT(ll size) { N = size; bit.resize(N + 1, 0); } // 一点更新です void add(ll a, ll w) { for (int x = a; x <= N; x += x & -x) bit[x] += w; } // 1~Nまでの和を求める。 ll sum(ll a) { ll ret = 0; for (ll x = a; x > 0; x -= x & -x) ret += bit[x]; return ret; } }; //転倒数ライブラリ ll numfalls(vl &A){ ll ans = 0; ll N = A.size(); BIT b(N); rep(i, N){ ans += i - b.sum(A.at(i)); b.add(A.at(i), 1); } return ans; } //#define _GLIBCXX_DEBUG #define mint998 modint998244353 #define mint107 modint1000000007 //約数列挙 vector<long long> div(long long n) { vector<long long> ret; set<ll> re; ll N = sqrt(n) + 1; for (long long i = 1; i <= N; i++) { if (n % i == 0) { re.insert(n / i); re.insert(i); } } for(auto value :re){ ret.push_back(value); } return ret; } ll digit_sum(ll X){ ll ans = 0; while(X > 0){ ans += X%10; X/=10; } return ans; } void xypress(vl &A){ vl B = A; sort(all(B)); B.erase(unique(B.begin(), B.end()), B.end()); vector<ll> res(A.size()); for (int i = 0; i < A.size(); ++i) { res[i] = lower_bound(B.begin(), B.end(), A[i]) - B.begin(); } A = res; } //素数列挙 std::vector<ll> prime( const ll N ) { std::vector<bool> is_prime( N + 1 ); for( ll i = 0; i <= N; i++ ) { is_prime[ i ] = true; } std::vector<ll> P; for( ll i = 2; i <= N; i++ ) { if( is_prime[ i ] ) { for( ll j = 2 * i; j <= N; j += i ) { is_prime[ j ] = false; } P.emplace_back( i ); } } return P; } //mod m での逆元 long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } //mod 998244353での割り算 ll inve(ll a, ll b){ a %= mod; return (a * modinv(b, mod) % mod); } vl vecsum(vl x){ vl s = {0}; rep(i, x.size()){ s.push_back(s.back() + x.at(i)); } return s; } signed main() { beg(); ll N, M; cin >> N >> M; ll a = N * (N + 1) / 2; if(a <= M){ cout << "Yes" << endl; } else{ cout << "No" << endl; } }