답안 #796096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
796096 2023-07-28T06:17:27 Z amirhoseinfar1385 Abracadabra (CEOI22_abracadabra) C++17
10 / 100
173 ms 15764 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn=1000+10;
int n,q;
int all[maxn][maxn];

void solve(int ind){
	int i=1,j=n/2+1;
	int z=1;
	while(i<=(n/2)&&j<=n){
		if(all[ind-1][i]<all[ind-1][j]){
			all[ind][z]=all[ind-1][i];
			z++;
			i++;
		}
		else{
			all[ind][z]=all[ind-1][j];
			j++;
			z++;
		}
	}
	while(i<=(n/2)){
		all[ind][z]=all[ind-1][i];
		i++;
		z++;
	}
	while(j<=n){
		all[ind][z]=all[ind-1][j];
		j++;
		z++;
	}
	return ;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>all[0][i];
	}
	for(int j=1;j<=n;j++){
		solve(j);
	}
	for(int i=0;i<q;i++){
		int u,v;
		cin>>u>>v;
		u=min(u,n);
		cout<<all[u][v]<<"\n";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 171 ms 15764 KB Output is correct
2 Correct 172 ms 15408 KB Output is correct
3 Correct 171 ms 15084 KB Output is correct
4 Correct 163 ms 13976 KB Output is correct
5 Correct 159 ms 15156 KB Output is correct
6 Correct 157 ms 14216 KB Output is correct
7 Correct 154 ms 15308 KB Output is correct
8 Correct 152 ms 14204 KB Output is correct
9 Correct 148 ms 14184 KB Output is correct
10 Correct 150 ms 14216 KB Output is correct
11 Correct 157 ms 14428 KB Output is correct
12 Correct 141 ms 13264 KB Output is correct
13 Correct 151 ms 13920 KB Output is correct
14 Correct 151 ms 14668 KB Output is correct
15 Correct 160 ms 14288 KB Output is correct
16 Correct 3 ms 4180 KB Output is correct
17 Correct 173 ms 13488 KB Output is correct
18 Correct 151 ms 13436 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 137 ms 9968 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 9232 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 171 ms 15764 KB Output is correct
2 Correct 172 ms 15408 KB Output is correct
3 Correct 171 ms 15084 KB Output is correct
4 Correct 163 ms 13976 KB Output is correct
5 Correct 159 ms 15156 KB Output is correct
6 Correct 157 ms 14216 KB Output is correct
7 Correct 154 ms 15308 KB Output is correct
8 Correct 152 ms 14204 KB Output is correct
9 Correct 148 ms 14184 KB Output is correct
10 Correct 150 ms 14216 KB Output is correct
11 Correct 157 ms 14428 KB Output is correct
12 Correct 141 ms 13264 KB Output is correct
13 Correct 151 ms 13920 KB Output is correct
14 Correct 151 ms 14668 KB Output is correct
15 Correct 160 ms 14288 KB Output is correct
16 Correct 3 ms 4180 KB Output is correct
17 Correct 173 ms 13488 KB Output is correct
18 Correct 151 ms 13436 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Runtime error 137 ms 9968 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -