Submission #76968553
Source Code Expand
#pragma region includes
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
struct custom_hash {
static ull splitmix64(ull x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
static ull hash_any(ull x) {
static const ull FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
size_t operator()(ull x) const {
return hash_any(x);
}
size_t operator()(const string& s) const {
return hash_any(std::hash<string>{}(s));
}
template<class T, class U>
size_t operator()(const pair<T, U>& p) const {
ull h1 = (*this)(p.first);
ull h2 = (*this)(p.second);
return splitmix64(h1 ^ (h2 + 0x9e3779b97f4a7c15 + (h1 << 6) + (h1 >> 2)));
}
};
template<class K, class V>
struct safe_map : gp_hash_table<K, V, custom_hash> {
bool count(const K& k) const { return this->find(k) != this->end(); }
};
template<class K>
struct safe_set : gp_hash_table<K, null_type, custom_hash> {
bool count(const K& k) const { return this->find(k) != this->end(); }
};
template<class K, class V> using umap = unordered_map<K, V, custom_hash>;
template<class K> using uset = unordered_set<K, custom_hash>;
// --- PBDS ---
// 直感的に使える ordered_set (重複を許さない単一要素版) のラッパー
template<class T>
struct OrderedSet {
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> st;
// 要素 x を追加 (既に存在する場合は何もしない)
void insert(T x) {
st.insert(x);
}
// 要素 x を削除 (存在する場合のみ)
void erase(T x) {
st.erase(x);
}
// 小さい方から k 番目 (0-indexed) の値を取得
T get_kth(int k) {
return *st.find_by_order(k);
}
// x より小さい要素の個数を取得
int count_less(T x) {
return st.order_of_key(x);
}
// 要素 x が存在するかどうかを判定
bool contains(T x) {
return st.find(x) != st.end();
}
int size() { return st.size(); }
bool empty() { return st.empty(); }
void clear() { st.clear(); }
};
// 直感的に使える ordered_multiset のラッパー
template<class T>
struct OrderedMultiset {
int id_counter = 0;
tree<pair<T, int>, null_type, less<pair<T, int>>, rb_tree_tag, tree_order_statistics_node_update> st;
// 要素 x を追加
void insert(T x) {
st.insert({x, id_counter++});
}
// 要素 x を 1 つ削除 (存在する場合のみ)
void erase(T x) {
auto it = st.lower_bound({x, -1});
if (it != st.end() && it->first == x) st.erase(it);
}
// 小さい方から k 番目 (0-indexed) の値を取得
T get_kth(int k) {
return st.find_by_order(k)->first;
}
// x より小さい要素の個数を取得
int count_less(T x) {
return st.order_of_key({x, -1});
}
// x 以下の要素の個数を取得
int count_less_equal(T x) {
return st.order_of_key({x, 2000000000}); // IDとして十分に大きな値を使用
}
int size() { return st.size(); }
bool empty() { return st.empty(); }
void clear() { st.clear(); id_counter = 0; }
};
// -----------
constexpr int MOD = 1000000007;
constexpr int MOD998 = 998244353;
using mint = atcoder::static_modint<MOD>;
using mint998 = atcoder::static_modint<MOD998>;
using dmint = atcoder::modint;
inline void set_mod(long long p) { dmint::set_mod(p); }
using int128 = __int128_t;
std::istream& operator>>(std::istream& is, __int128_t& v) {
std::string s; is >> s; v = 0; int sign = 1, i = 0;
if (s[0] == '-') { sign = -1; i = 1; }
for (; i < (int)s.size(); ++i) v = v * 10 + (s[i] - '0');
v *= sign; return is;
}
std::ostream& operator<<(std::ostream& os, __int128_t v) {
if (v == 0) return os << "0";
if (v < 0) { os << '-'; v = -v; }
std::string s; while (v > 0) { s += (char)('0' + (v % 10)); v /= 10; }
std::reverse(s.begin(), s.end()); return os << s;
}
template <int m> istream& operator>>(istream& is, atcoder::static_modint<m>& v) { long long x; is >> x; v = x; return is; }
template <int m> ostream& operator<<(ostream& os, const atcoder::static_modint<m>& v) { return os << v.val(); }
template <int id> istream& operator>>(istream& is, atcoder::dynamic_modint<id>& v) { long long x; is >> x; v = x; return is; }
template <int id> ostream& operator<<(ostream& os, const atcoder::dynamic_modint<id>& v) { return os << v.val(); }
#define rep(i, x, limit) for (ll i = (ll)x; i < (ll)limit; i++)
#define rrep(i, x, limit) for (ll i = (ll)x; i >= (ll)limit; i--)
#define reps(i, a, b, s) for (long long i = (a); i < (b); i += (s))
#define rreps(i, a, b, s) for (long long i = (a); i >= (b); i -= (s))
#define rep2(i, start_i, limit_i, j, start_j, limit_j) for (ll i = (ll)(start_i); i < (ll)(limit_i); i++) for (ll j = (ll)(start_j); j < (ll)(limit_j); j++)
constexpr int inf = 1073741823;
constexpr ll infl = 1LL << 60;
// 右、下、左、上の順
constexpr int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// 右、右下、下、左下、左、左上、上、右上の順
constexpr int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long double PI = 3.1415926535897932384626433832795028841971;
// グローバル領域などで定義
constexpr int128 P10[21] = {
1LL,
10LL,
100LL,
1'000LL,
10'000LL,
100'000LL,
1'000'000LL,
10'000'000LL,
100'000'000LL,
1'000'000'000LL,
10'000'000'000LL,
100'000'000'000LL,
1'000'000'000'000LL,
10'000'000'000'000LL,
100'000'000'000'000LL,
1'000'000'000'000'000LL,
10'000'000'000'000'000LL,
100'000'000'000'000'000LL,
1'000'000'000'000'000'000LL,
1'000'000'000'000'000'0000,
1'000'000'000'000'000'00000
};
inline constexpr long long pow2(int i) { return 1LL << i; }
inline int bitcount(long long x) {
return __builtin_popcountll(x);
}
#define alp "abcdefghijklmnopqrstuvwxyz"
#define ALP "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define nall(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define pob pop_back
#define eb emplace_back
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
void YN(bool cond) { cout << (cond ? "Yes" : "No") << "\n"; }
#define endl "\n"
#define syousu cout<<fixed<<setprecision(15)
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1, T2>& p) { is >> p.first >> p.second; return is; }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { for (auto& e : v) is >> e; return is; }
template <typename T> void print(const vector<T>& v) { for (int i = 0; i < (int)v.size(); i++) cout << v[i] << (i + 1 == (int)v.size() ? "" : " "); cout << "\n"; }
#define VEC(type, name, size) vector<type> name(size)
#define VECI(type, name, size, init) vector<type> name(size, init)
#define VVEC(type, name, h, w) vector<vector<type>> name(h, vector<type>(w))
#define VVECI(type, name, h, w, init) vector<vector<type>> name(h, vector<type>(w, init))
#define VVVEC(type, name, d, h, w) vector<vector<vector<type>>> name(d, vector<vector<type>>(h, vector<type>(w)))
#define VVVECI(type, name, d, h, w, init) vector<vector<vector<type>>> name(d, vector<vector<type>>(h, vector<type>(w, init)))
#define VVVVEC(type, name, d1, d2, d3, d4) vector<vector<vector<vector<type>>>> name(d1, vector<vector<vector<type>>>(d2, vector<vector<type>>(d3, vector<type>(d4))))
#define VVVVECI(type, name, d1, d2, d3, d4, init) vector<vector<vector<vector<type>>>> name(d1, vector<vector<vector<type>>>(d2, vector<vector<type>>(d3, vector<type>(d4, init))))
#define VECP(type1, type2, name, size) vector<pair<type1, type2>> name(size)
#define VECPI(type1, type2, name, size, init) vector<pair<type1, type2>> name(size, init)
#define VP(type1, type2) vector<pair<type1, type2>>
#define VVECP(type1, type2, name, h, w) vector<vector<pair<type1, type2>>> name(h, vector<pair<type1, type2>>(w))
#define VVECPI(type1, type2, name, h, w, init) vector<vector<pair<type1, type2>>> name(h, vector<pair<type1, type2>>(w, init))
#define VVP(type1, type2) vector<vector<pair<type1, type2>>>
#define VECT(type1, type2, type3, name, size) vector<tuple<type1, type2, type3>> name(size)
#define VECTI(type1, type2, type3, name, size, init) vector<tuple<type1, type2, type3>> name(size, init)
#define VT(type1, type2, type3) vector<tuple<type1, type2, type3>>
template<typename T> T SUM(const vector<T>& v) { return accumulate(v.begin(), v.end(), (T)0); }
template<typename T> T MAX(const vector<T>& v) { return *max_element(v.begin(), v.end()); }
template<typename T> T MIN(const vector<T>& v) { return *min_element(v.begin(), v.end()); }
template<class T> using min_pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> using max_pq = priority_queue<T>;
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> void uniq(vector<T>& v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); }
template <typename T> void dec(vector<T>& a) { for (auto& x : a) x--; }
bool in_range(int x, int y, int h, int w) { return x >= 0 && x < h && y >= 0 && y < w; }
ll ceil_div(ll n, ll d) { return n >= 0 ? (n + d - 1) / d : n / d; }
ll floor_div(ll n, ll d) { return n >= 0 ? n / d : (n - d + 1) / d; }
// 精度ほぼ無限の平方根
long long integer_sqrt(long long N) {
if (N <= 0) return 0;
long long x = sqrt((long double)N);
while ((__int128)(x + 1) * (x + 1) <= N) x++;
while ((__int128)x * x > N) x--;
return x;
}
// 文字列 s の idx 番目の文字を1つ削除した新しい文字列を返す
// 使い方: S = erase_char(S, 3);
string erase_char(string s, int idx) {
if (idx < 0 || idx >= (int)s.length()) return s; // 範囲外アクセスの防止
s.erase(s.begin() + idx);
return s;
}
// 文字列 s の idx 番目に文字 c を挿入した新しい文字列を返す
// 使い方: S = insert_char(S, 3, 'a');
string insert_char(string s, int idx, char c) {
if (idx < 0) idx = 0;
if (idx > (int)s.length()) idx = s.length();
s.insert(s.begin() + idx, c);
return s;
}
// アルファベットの大文字・小文字を反転させる関数
inline char flip_char(char c) {
if (islower(c)) return toupper(c);
if (isupper(c)) return tolower(c);
return c; // アルファベット以外が来た場合はそのまま返す
}
template<typename T> T GCD(const vector<T>& v) { T res = 0; for (T x : v) res = std::gcd(res, x); return res; }
template<typename T> T LCM(const vector<T>& v) { T res = 1; for (T x : v) res = std::lcm(res, x); return res; }
template<typename T> void extend(vector<T>& a, const vector<T>& b) { a.insert(a.end(), b.begin(), b.end()); }
template<typename T> void double_vec(vector<T>& a) { int n = a.size(); a.reserve(n * 2); for(int i = 0; i < n; i++) a.push_back(a[i]); }
long long nC2(long long n) { return n < 2 ? 0 : (ll)((int128)n * (n - 1) / 2); }
long long nC3(long long n) { return n < 3 ? 0 : (ll)((int128)n * (n - 1) * (n - 2) / 6); }
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
#pragma endregion
using m1 = atcoder::static_modint<1>;
int main() {
//※※積の問題の0除算 文字列ですべて同じ文字パターン オーバーフロー
//※※ifの配列外参照を対策するなら初めに書かないとダメ 対角線は両方チェック
//※※bit演算は比較演算子より後に計算されるから同時に使うときは()つける
//※※ループの中で配列を宣言しない(外で宣言して使いまわす)
//※※範囲for文で文字列、配列を受け取るときfor (auto& row : grid)のように&つけて参照渡し
//※※2^63→ほぼ10^19(他は2^10を10^3とすると楽),log2は10^xのxを10/3する(10^18→60)
//※※int:~10^9 ll:~10^18 int128:~10^38
//※※DFSはバックトラックが遅い!戻らなければO(N+M)。(BFSも同じ)
//※※辞書順は貪欲法!絶対後戻りしないようにする
//※※整数の平方根を使うならinteger_sqrtを使う!
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
auto start_time = chrono::steady_clock::now();
ll N;
cin>>N;
VEC(ll,A,N);
cin>>A;
auto B=A;
sort(nall(B));
rep(i,0,N){
cout<<N-(upper_bound(nall(B),A[i])-B.begin())<<" ";
}
auto end_time = chrono::steady_clock::now();
auto duration = chrono::duration_cast<chrono::milliseconds>(end_time - start_time);
cerr << "Execution Time: " << duration.count() << " ms" << endl;
return 0;
}
/*
*/
Submission Info
Submission Time
2026-06-26 20:34:11+0900
Task
E - Mountain View
User
siooisi
Language
C++23 (GCC 15.2.0)
Score
333
Code Size
13511 Byte
Status
AC
Exec Time
50 ms
Memory
6696 KiB
Compile Error
./Main.cpp:185:5: warning: integer constant is so large that it is unsigned
185 | 1'000'000'000'000'000'0000,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./Main.cpp:186:5: warning: integer constant is too large for its type
186 | 1'000'000'000'000'000'00000
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
333 / 333
Status
Set Name
Test Cases
Sample
sample01.txt, sample02.txt, sample03.txt
All
sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt, in65.txt, in66.txt, in67.txt, in68.txt
Case Name
Status
Exec Time
Memory
in01.txt
AC
1 ms
3576 KiB
in02.txt
AC
1 ms
3520 KiB
in03.txt
AC
1 ms
3632 KiB
in04.txt
AC
1 ms
3520 KiB
in05.txt
AC
1 ms
3712 KiB
in06.txt
AC
1 ms
3516 KiB
in07.txt
AC
1 ms
3604 KiB
in08.txt
AC
1 ms
3516 KiB
in09.txt
AC
22 ms
6648 KiB
in10.txt
AC
48 ms
6504 KiB
in11.txt
AC
48 ms
6648 KiB
in12.txt
AC
49 ms
6656 KiB
in13.txt
AC
47 ms
6524 KiB
in14.txt
AC
26 ms
6656 KiB
in15.txt
AC
48 ms
6556 KiB
in16.txt
AC
1 ms
3712 KiB
in17.txt
AC
18 ms
6496 KiB
in18.txt
AC
24 ms
6528 KiB
in19.txt
AC
23 ms
6548 KiB
in20.txt
AC
19 ms
6528 KiB
in21.txt
AC
26 ms
6540 KiB
in22.txt
AC
18 ms
6556 KiB
in23.txt
AC
23 ms
6584 KiB
in24.txt
AC
17 ms
6688 KiB
in25.txt
AC
48 ms
6688 KiB
in26.txt
AC
35 ms
6656 KiB
in27.txt
AC
22 ms
6696 KiB
in28.txt
AC
1 ms
3632 KiB
in29.txt
AC
1 ms
3460 KiB
in30.txt
AC
40 ms
6648 KiB
in31.txt
AC
32 ms
6584 KiB
in32.txt
AC
1 ms
3632 KiB
in33.txt
AC
1 ms
3576 KiB
in34.txt
AC
37 ms
6656 KiB
in35.txt
AC
1 ms
3712 KiB
in36.txt
AC
1 ms
3596 KiB
in37.txt
AC
1 ms
3516 KiB
in38.txt
AC
1 ms
3628 KiB
in39.txt
AC
1 ms
3608 KiB
in40.txt
AC
1 ms
3704 KiB
in41.txt
AC
24 ms
6648 KiB
in42.txt
AC
49 ms
6556 KiB
in43.txt
AC
34 ms
5888 KiB
in44.txt
AC
48 ms
6532 KiB
in45.txt
AC
50 ms
6648 KiB
in46.txt
AC
47 ms
6688 KiB
in47.txt
AC
18 ms
6496 KiB
in48.txt
AC
21 ms
6628 KiB
in49.txt
AC
49 ms
6532 KiB
in50.txt
AC
48 ms
6628 KiB
in51.txt
AC
38 ms
6596 KiB
in52.txt
AC
47 ms
6512 KiB
in53.txt
AC
46 ms
6496 KiB
in54.txt
AC
1 ms
3516 KiB
in55.txt
AC
1 ms
3540 KiB
in56.txt
AC
1 ms
3608 KiB
in57.txt
AC
1 ms
3552 KiB
in58.txt
AC
1 ms
3712 KiB
in59.txt
AC
1 ms
3512 KiB
in60.txt
AC
1 ms
3608 KiB
in61.txt
AC
1 ms
3644 KiB
in62.txt
AC
1 ms
3576 KiB
in63.txt
AC
1 ms
3660 KiB
in64.txt
AC
1 ms
3628 KiB
in65.txt
AC
1 ms
3472 KiB
in66.txt
AC
1 ms
3712 KiB
in67.txt
AC
1 ms
3516 KiB
in68.txt
AC
1 ms
3604 KiB
sample01.txt
AC
1 ms
3500 KiB
sample02.txt
AC
1 ms
3596 KiB
sample03.txt
AC
1 ms
3628 KiB