답안 #725793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
725793 2023-04-18T05:27:31 Z Cutebol Abracadabra (CEOI22_abracadabra) C++17
10 / 100
1414 ms 21120 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
   
using namespace std;
//using namespace __gnu_pbds;
   
//void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
//#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define Shenhe ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
#define int long long
#define pb push_back
#define ss second
#define sz size()
#define ff first

const int N = 2e5 + 5 ;
const int mod = 1e9+7 ;
const int inf = 1e18 ;
 
int n , q ;
int a[N] ;
int b[1005][1055] ;

void solve(){
	
	cin >> n >> q ;
	for ( int i = 0 ; i < n ; i ++ ) cin >> b[0][i] ;
	for ( int i = 1 ; i < n ; i ++ ){
		int l = 0 , r = n/2 ;
		for ( int j = 0 ; j < n ; j ++ ){
			if ( b[i-1][l] < b[i-1][r] ) b[i][j] = b[i-1][l] , l ++ ;
			else b[i][j] = b[i-1][r] , r ++ ;
			if ( l == n/2 ){
				j ++ ;
				for ( ; j < n ; j ++ ){
					b[i][j] = b[i-1][r] ;
					r ++ ;
				}
				break ;
			}
			if ( r == n ){
				j ++ ;
				for ( ; j < n ; j ++ ){
					b[i][j] = b[i-1][l] ;
					l ++ ;
				}
				break ;
			}
		}
	}
	while ( q -- ){
		int t , x ;
		cin >> t >> x ;
		cout << b[min(t,n-1)][x-1] << endl ;
	}
}
 
signed main(){
	Shenhe ;
	int t = 1 ;
//	cin >> t ;
	while ( t -- ) solve() ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1414 ms 12468 KB Output is correct
2 Correct 1367 ms 12520 KB Output is correct
3 Correct 1312 ms 12020 KB Output is correct
4 Correct 1216 ms 12104 KB Output is correct
5 Correct 1346 ms 12512 KB Output is correct
6 Correct 1325 ms 12140 KB Output is correct
7 Correct 1363 ms 12484 KB Output is correct
8 Correct 1270 ms 12004 KB Output is correct
9 Correct 1229 ms 12244 KB Output is correct
10 Correct 1260 ms 12040 KB Output is correct
11 Correct 1322 ms 12288 KB Output is correct
12 Correct 1344 ms 11892 KB Output is correct
13 Correct 1312 ms 12188 KB Output is correct
14 Correct 1337 ms 12412 KB Output is correct
15 Correct 1372 ms 12384 KB Output is correct
16 Correct 5 ms 8404 KB Output is correct
17 Correct 1265 ms 11980 KB Output is correct
18 Correct 1255 ms 12116 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 198 ms 20756 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 137 ms 21120 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1414 ms 12468 KB Output is correct
2 Correct 1367 ms 12520 KB Output is correct
3 Correct 1312 ms 12020 KB Output is correct
4 Correct 1216 ms 12104 KB Output is correct
5 Correct 1346 ms 12512 KB Output is correct
6 Correct 1325 ms 12140 KB Output is correct
7 Correct 1363 ms 12484 KB Output is correct
8 Correct 1270 ms 12004 KB Output is correct
9 Correct 1229 ms 12244 KB Output is correct
10 Correct 1260 ms 12040 KB Output is correct
11 Correct 1322 ms 12288 KB Output is correct
12 Correct 1344 ms 11892 KB Output is correct
13 Correct 1312 ms 12188 KB Output is correct
14 Correct 1337 ms 12412 KB Output is correct
15 Correct 1372 ms 12384 KB Output is correct
16 Correct 5 ms 8404 KB Output is correct
17 Correct 1265 ms 11980 KB Output is correct
18 Correct 1255 ms 12116 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Runtime error 198 ms 20756 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -