# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
725792 | 2023-04-18T04:56:56 Z | Baytoro | Abracadabra (CEOI22_abracadabra) | C++17 | 267 ms | 16052 KB |
#include <bits/stdc++.h> using namespace std; #define ios ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define endl '\n' #define ll long long #define int long long void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } const ll INF=1e18,mod=1e9+9,N=1e6+5; int a[1005][1005]; void solve(){ int n,q;cin>>n>>q; for(int i=0;i<n;i++) cin>>a[i][0]; for(int j=1;j<=n;j++){ int l=0,r=n/2,cur=0; for(int i=0;i<n && l<n/2 && r<n;i++){ if(a[l][j-1]<a[r][j-1]) a[cur++][j]=a[l++][j-1]; else a[cur++][j]=a[r++][j-1]; } while(l<n/2) a[cur++][j]=a[l++][j-1]; while(r<n) a[cur++][j]=a[r++][j-1]; } while(q--){ int x,y;cin>>y>>x; y=min(y,n); cout<<a[x-1][y]<<endl; } } main(){ //fopn("team"); ios; int T=1; //cin>>T; for(int i=1;i<=T;i++){ //cout<<"Case #"<<i<<": "; solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 12068 KB | Output is correct |
2 | Correct | 267 ms | 16052 KB | Output is correct |
3 | Correct | 259 ms | 15460 KB | Output is correct |
4 | Correct | 204 ms | 15468 KB | Output is correct |
5 | Correct | 244 ms | 15996 KB | Output is correct |
6 | Correct | 204 ms | 15424 KB | Output is correct |
7 | Correct | 267 ms | 15820 KB | Output is correct |
8 | Correct | 193 ms | 15340 KB | Output is correct |
9 | Correct | 205 ms | 15788 KB | Output is correct |
10 | Correct | 203 ms | 15308 KB | Output is correct |
11 | Correct | 204 ms | 15708 KB | Output is correct |
12 | Correct | 189 ms | 15336 KB | Output is correct |
13 | Correct | 194 ms | 15460 KB | Output is correct |
14 | Correct | 206 ms | 15820 KB | Output is correct |
15 | Correct | 192 ms | 15692 KB | Output is correct |
16 | Correct | 5 ms | 8140 KB | Output is correct |
17 | Correct | 189 ms | 15436 KB | Output is correct |
18 | Correct | 189 ms | 15316 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 8540 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 8528 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 12068 KB | Output is correct |
2 | Correct | 267 ms | 16052 KB | Output is correct |
3 | Correct | 259 ms | 15460 KB | Output is correct |
4 | Correct | 204 ms | 15468 KB | Output is correct |
5 | Correct | 244 ms | 15996 KB | Output is correct |
6 | Correct | 204 ms | 15424 KB | Output is correct |
7 | Correct | 267 ms | 15820 KB | Output is correct |
8 | Correct | 193 ms | 15340 KB | Output is correct |
9 | Correct | 205 ms | 15788 KB | Output is correct |
10 | Correct | 203 ms | 15308 KB | Output is correct |
11 | Correct | 204 ms | 15708 KB | Output is correct |
12 | Correct | 189 ms | 15336 KB | Output is correct |
13 | Correct | 194 ms | 15460 KB | Output is correct |
14 | Correct | 206 ms | 15820 KB | Output is correct |
15 | Correct | 192 ms | 15692 KB | Output is correct |
16 | Correct | 5 ms | 8140 KB | Output is correct |
17 | Correct | 189 ms | 15436 KB | Output is correct |
18 | Correct | 189 ms | 15316 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Runtime error | 13 ms | 8540 KB | Execution killed with signal 11 |
22 | Halted | 0 ms | 0 KB | - |