Submission #668595

# Submission time Handle Problem Language Result Execution time Memory
668595 2022-12-04T08:23:17 Z Shahrad Abracadabra (CEOI22_abracadabra) C++17
0 / 100
218 ms 16076 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define endl '\n'
#define pb push_back
#define mk make_pair
#define sz size()
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define kill(x) return cout << x << endl, void();
#define int ll
#define pii pair <int, int>

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target ("avx2")

const int N = 2e5 + 5, M = 8e2 + 5;
const int MOD = 998244353, INF = 2e9, sq = 300;

int a[M][N];
int n;

void merge (int x)
{
	int l = 0, l2 = n / 2, l3 = 0;
	while (l < n / 2 && l2 < n)
	{
		if (a[x - 1][l] < a[x - 1][l2])
			a[x][l3++] = a[x - 1][l++];
		else
			a[x][l3++] = a[x - 1][l2++];
	}
	while (l < n / 2)
		a[x][l3++] = a[x - 1][l++];
	while (l2 < n)
		a[x][l3++] = a[x - 1][l2++];
}

void Solve ()
{
	int q, t, x;
	cin >> n >> q;
	if (n > 1000)
		return;
	for (int i = 0; i < n; i++)
		cin >> a[0][i];
	for (int i = 1; i < M; i++)
		merge (i);
	for (int i = 0; i < q; i++)
	{
		cin >> t >> x;
		cout << a[min (t, M - 1)][x - 1] << endl;
	}
}

int32_t main ()
{
	ios::sync_with_stdio (0), cin.tie (0), cout.tie (0);
	int tt = 1;
//	cin >> tt;
	while (tt--)
		Solve ();
}
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 16076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 16076 KB Output isn't correct
2 Halted 0 ms 0 KB -