QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#687290 | #6471. Binary Transformations | PetroTarnavskyi# | WA | 0ms | 3856kb | C++23 | 887b | 2024-10-29 18:03:02 | 2024-10-29 18:03:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
VI a(n);
FOR(i, 0, n)
cin >> a[i];
VI order(n);
iota(ALL(order), 0);
sort(ALL(order), [&](int i, int j){return MP(a[i], i) < MP(a[j], j);});
VI ans(n);
int x = n;
for(int i : order)
ans[i] = x--;
FOR(i, 0, n)
{
if(i)
cout << " ";
cout << ans[i];
}
cout << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3856kb
input:
5 5 2 6 1 5 01110 10011
output:
3 4 1 5 2
result:
wrong answer 1st lines differ - expected: '21', found: '3 4 1 5 2'