답안 #983430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983430 2024-05-15T12:25:03 Z alexdd Abracadabra (CEOI22_abracadabra) C++17
10 / 100
3000 ms 30152 KB
#include<bits/stdc++.h>
using namespace std;
const int bulan = 5000;
int n,q;
vector<int> a;
vector<int> qrys[bulan+5];
int rez[1000005],u[1000005];
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>q;
    a.resize(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    int t;
    for(int i=1;i<=q;i++)
    {
        cin>>t>>u[i];
        u[i]--;
        t = min(t,bulan);
        qrys[t].push_back(i);
        rez[i]=-1;
    }
    for(int pas=0;pas<=bulan+2;pas++)
    {
        for(auto x:qrys[pas])
            rez[x] = a[u[x]];
        deque<int> le,ri;
        vector<int> newa;
        for(int i=0;i<n/2;i++)
            le.push_back(a[i]);
        for(int i=n/2;i<n;i++)
            ri.push_back(a[i]);
        for(int i=0;i<n;i++)
        {
            if(!le.empty() && (ri.empty() || le.front()<ri.front()))
            {
                newa.push_back(le.front());
                le.pop_front();
            }
            else
            {
                newa.push_back(ri.front());
                ri.pop_front();
            }
        }
        if(a==newa)
        {
            break;
        }
        a = newa;
    }
    for(int i=1;i<=q;i++)
    {
        if(rez[i]==-1) rez[i] = a[u[i]];
        cout<<rez[i]<<"\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 25300 KB Output is correct
2 Correct 155 ms 24284 KB Output is correct
3 Correct 157 ms 23532 KB Output is correct
4 Correct 142 ms 22888 KB Output is correct
5 Correct 164 ms 25364 KB Output is correct
6 Correct 149 ms 24308 KB Output is correct
7 Correct 167 ms 25684 KB Output is correct
8 Correct 163 ms 23528 KB Output is correct
9 Correct 142 ms 23412 KB Output is correct
10 Correct 161 ms 22860 KB Output is correct
11 Correct 140 ms 22864 KB Output is correct
12 Correct 133 ms 21156 KB Output is correct
13 Correct 146 ms 22592 KB Output is correct
14 Correct 146 ms 24180 KB Output is correct
15 Correct 154 ms 23192 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 139 ms 21372 KB Output is correct
18 Correct 163 ms 21456 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3024 ms 30152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2879 ms 11532 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 25300 KB Output is correct
2 Correct 155 ms 24284 KB Output is correct
3 Correct 157 ms 23532 KB Output is correct
4 Correct 142 ms 22888 KB Output is correct
5 Correct 164 ms 25364 KB Output is correct
6 Correct 149 ms 24308 KB Output is correct
7 Correct 167 ms 25684 KB Output is correct
8 Correct 163 ms 23528 KB Output is correct
9 Correct 142 ms 23412 KB Output is correct
10 Correct 161 ms 22860 KB Output is correct
11 Correct 140 ms 22864 KB Output is correct
12 Correct 133 ms 21156 KB Output is correct
13 Correct 146 ms 22592 KB Output is correct
14 Correct 146 ms 24180 KB Output is correct
15 Correct 154 ms 23192 KB Output is correct
16 Correct 1 ms 2648 KB Output is correct
17 Correct 139 ms 21372 KB Output is correct
18 Correct 163 ms 21456 KB Output is correct
19 Correct 1 ms 2392 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Execution timed out 3024 ms 30152 KB Time limit exceeded
22 Halted 0 ms 0 KB -