Submission #899985

# Submission time Handle Problem Language Result Execution time Memory
899985 2024-01-07T11:59:02 Z I_am_Polish_Girl Abracadabra (CEOI22_abracadabra) C++14
10 / 100
607 ms 36024 KB
/*
* powered by ANDRIY POPYK
* in honor of  SEGMENT DECOMPOSITION and N ^ (log(N)) and hate_club_Dasha_Lobas
* I hate GeZhiyuan
* fuck you
*/


#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt")


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;
typedef long long ll;

#define int long long

int mod = 1000000007;
int inf = 1000000000000000000;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int times_ = 1;

    //cin >> times_;

    while (times_--)
    {
        int n , k;
        cin >> n >> k;

        vector <int> a(n);


        for (int i = 0; i < n; i++)
            cin >> a[i];


        int col = 1000;

        vector <vector <pair <int, int>>> q(col+1);


        vector <int> ans(k , -1);
        for (int i = 0; i < k; i++)
        {
            int t, ind;

            cin >> t >> ind;

            q[min(t , col)].push_back({ ind , i });
        }

        for (int i = 0; i <= col; i++)
        {
            vector <int> b;


            int ind1 = 0;
            int ind2 = n / 2;

            for (int j = 0; j < n; j++)
            {
                if (ind1 == n / 2)
                {
                    b.push_back(a[ind2]);
                    ind2++;
                    continue;
                }

                if (ind2 == n)
                {
                    b.push_back(a[ind1]);
                    ind1++;
                    continue;
                }

                if (a[ind1] < a[ind2])
                {
                    b.push_back(a[ind1]);
                    ind1++;
                    continue;
                }
                else
                {
                    b.push_back(a[ind2]);
                    ind2++;
                    continue;
                }
            }

            for (int j = 0; j < q[i].size(); j++)
            {
                ans[q[i][j].second] = a[q[i][j].first - 1];
            }

            a = b;
            /*
            for (int i = 0; i < n; i++)
                cout << a[i] << " ";
            cout << "\n**\n";

            */
        }


        for (int i = 0; i < k; i++)
            cout << ans[i] << "\n";

        
    }
}

Compilation message

Main.cpp:11: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   11 | #pragma GCC optimization("unroll-loops")
      | 
Main.cpp: In function 'int main()':
Main.cpp:111:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  111 |             for (int j = 0; j < q[i].size(); j++)
      |                             ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 158 ms 32152 KB Output is correct
2 Correct 176 ms 30140 KB Output is correct
3 Correct 155 ms 29396 KB Output is correct
4 Correct 151 ms 27480 KB Output is correct
5 Correct 161 ms 32768 KB Output is correct
6 Correct 147 ms 30636 KB Output is correct
7 Correct 159 ms 35004 KB Output is correct
8 Correct 147 ms 29264 KB Output is correct
9 Correct 170 ms 28572 KB Output is correct
10 Correct 160 ms 28292 KB Output is correct
11 Correct 152 ms 28348 KB Output is correct
12 Correct 147 ms 30096 KB Output is correct
13 Correct 158 ms 27116 KB Output is correct
14 Correct 160 ms 30456 KB Output is correct
15 Correct 208 ms 28684 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 149 ms 27420 KB Output is correct
18 Correct 143 ms 27052 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 534 ms 36024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 607 ms 5436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 32152 KB Output is correct
2 Correct 176 ms 30140 KB Output is correct
3 Correct 155 ms 29396 KB Output is correct
4 Correct 151 ms 27480 KB Output is correct
5 Correct 161 ms 32768 KB Output is correct
6 Correct 147 ms 30636 KB Output is correct
7 Correct 159 ms 35004 KB Output is correct
8 Correct 147 ms 29264 KB Output is correct
9 Correct 170 ms 28572 KB Output is correct
10 Correct 160 ms 28292 KB Output is correct
11 Correct 152 ms 28348 KB Output is correct
12 Correct 147 ms 30096 KB Output is correct
13 Correct 158 ms 27116 KB Output is correct
14 Correct 160 ms 30456 KB Output is correct
15 Correct 208 ms 28684 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Correct 149 ms 27420 KB Output is correct
18 Correct 143 ms 27052 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 534 ms 36024 KB Output isn't correct
22 Halted 0 ms 0 KB -