QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261622 | #6476. Escape Room | illyakr# | WA | 1ms | 3816kb | C++17 | 1.1kb | 2023-11-23 03:41:37 | 2023-11-23 03:41:37 |
Judging History
answer
#include <bits/stdc++.h>
//#include <bits/extc++.h>
//using namespace __gnu_pbds;
//template<class T>
//using Tree= tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#pragma GCC optimize("O3")
//#define int long long
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n; cin >> n;
set<tuple<int, double, int>> st;
st.insert({0, 0, n});
vector<int> a(n);
double sub = 1e9;
for (int& v : a) cin >> v;
for (int i = n - 1; i >= 0; --i) {
auto [ln, vl, id] = *prev(st.lower_bound({a[i], -1e12, -1e12}));
assert(ln + 1 == a[i]);
st.insert({a[i], vl - sub, i});
sub /= 3;
}
vector<int> res(n);
vector<pair<double, int>> vals;
for (auto [ln, vl, id] : st) if (id < n) vals.push_back({vl, id});
sort(vals.begin(), vals.end());
int i = 1;
for (auto [x, p] : vals) res[p] = i++;
for (int v : res) cout << v << ' '; cout << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3632kb
input:
4 1 2 2 1
output:
4 2 1 3
result:
ok single line: '4 2 1 3 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
1 1
output:
1
result:
ok single line: '1 '
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3816kb
input:
100 11 5 5 11 9 3 5 7 3 1 7 1 5 6 3 1 7 6 8 7 10 2 7 7 6 8 3 8 9 1 7 6 3 4 1 2 1 9 9 1 2 1 2 8 5 7 3 4 3 1 2 4 5 8 7 6 6 4 3 7 3 4 5 3 3 3 3 1 1 5 1 5 5 3 4 1 4 6 3 5 1 5 1 5 4 2 2 3 2 1 2 1 2 2 2 1 2 2 2 1
output:
25 75 76 26 57 95 77 58 94 100 59 99 78 60 93 98 61 62 63 64 27 96 65 66 67 68 89 69 28 97 70 71 88 79 92 90 91 29 30 87 85 86 83 31 72 32 80 73 74 84 81 48 46 33 34 35 24 47 49 13 45 43 36 44 42 41 40 82 56 23 55 22 21 39 37 54 20 14 38 15 53 12 52 11 16 50 19 17 18 51 9 10 7 6 5 8 3 2 1 4
result:
wrong answer 1st lines differ - expected: '2 42 41 1 7 66 40 22 65 100 21...5 73 84 72 71 70 83 69 68 67 82', found: '25 75 76 26 57 95 77 58 94 100... 17 18 51 9 10 7 6 5 8 3 2 1 4 '