QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687290#6471. Binary TransformationsPetroTarnavskyi#WA 0ms3856kbC++23887b2024-10-29 18:03:022024-10-29 18:03:04

Judging History

你现在查看的是最新测评结果

  • [2024-10-29 18:03:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3856kb
  • [2024-10-29 18:03:02]
  • 提交

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'