QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#614312 | #8837. Increasing Income | ucup-team2432# | WA | 1ms | 3784kb | C++20 | 1.4kb | 2024-10-05 16:09:20 | 2024-10-05 16:09:25 |
Judging History
answer
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(),vec.end()
#define umap __gnu_pbds::gp_hash_table
using ll = long long;
using db = double;
#define Emu Smile
using namespace std;
void chmax(auto &a, auto b) { if (a < b) a = b; }
void chmin(auto &a, auto b) { if (a > b) a = b; }
inline int lbt(int x) { return x & (-x); }
const ll inf = 1e16;
void solve() {
int n; cin >> n;
vector<int> p(n);
for (int i = 0; i < n; ++i) {
cin >> p[i]; p[i] --;
}
int res1 = 0, res2 = 0;
{
for (int i = 0, j = -1; i < n; ++i) {
if (p[i] > j) {
res1 ++; j = p[i];
}
}
res1 += n;
}
vector<int> q(n);
for (int i = 0; i < n; ++i) {
q[p[i]] = i;
}
{
for (int i = 0, j = -1; i < n; ++i) {
if (q[i] > j) {
res2 ++; j = q[i];
}
}
res2 += n;
}
if (res1 >= res2) {
vector<int> ret(n);
iota(all(ret), 0);
for (auto x : ret) {
cout << x + 1 << " ";
}
cout << '\n';
} else {
for (auto x : q) {
cout << x + 1 << " ";
}
cout << '\n';
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
// init();
cout << fixed << setprecision(2);
int OuO = 1;
cin >> OuO;
for (int piastic = 0; piastic < OuO; ++piastic) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
input:
3 3 1 2 3 4 2 4 3 1 5 1 5 2 4 3
output:
1 2 3 1 2 3 4 1 3 5 4 2
result:
ok Correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3612kb
input:
153 4 2 4 3 1 4 1 4 2 3 5 2 1 4 5 3 5 1 4 5 3 2 4 1 3 2 4 5 1 5 2 4 3 5 5 3 1 2 4 5 4 1 2 5 3 5 1 2 5 3 4 5 3 1 4 2 5 5 5 4 2 3 1 5 2 1 5 4 3 5 3 4 1 5 2 5 1 4 3 5 2 5 5 1 3 4 2 5 5 3 2 4 1 5 1 5 3 2 4 5 2 4 3 1 5 5 1 5 4 3 2 5 1 2 4 5 3 5 4 2 5 3 1 5 1 3 5 2 4 5 3 1 4 5 2 3 2 1 3 5 1 2 4 3 5 5 5 1 ...
output:
1 2 3 4 1 3 4 2 1 2 3 4 5 1 2 3 4 5 1 2 3 4 1 3 5 4 2 3 4 2 5 1 2 3 5 1 4 1 2 4 5 3 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 2 5 3 4 1 1 2 3 4 5 1 4 3 5 2 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 1 2 3 4 5 2 3 5 4 1 3 4 1 5 2 3 5 4 2 1 1 ...
result:
wrong answer Jury found better answer than participant (test case 11)